Skip to content

Commit 1196c17

Browse files
committed
Introduce AtomIndex type
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent 8eae957 commit 1196c17

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/libAtomVM/atom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extern "C" {
4545
#define ATOM_STR(LENSTR, STR) (LENSTR STR)
4646

4747
typedef const void *AtomString;
48+
typedef uint32_t AtomIndex;
4849

4950
/**
5051
* @brief Gets a C string from an AtomString

src/libAtomVM/term.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <stdlib.h>
3838
#include <string.h>
3939

40+
#include "atom.h"
4041
#include "memory.h"
4142
#include "refc_binary.h"
4243
#include "utils.h"
@@ -599,7 +600,7 @@ static inline term term_nil()
599600
* @param t the term that will be converted to atom table index. t must be a valid atom term.
600601
* @return a global atom table index.
601602
*/
602-
static inline int term_to_atom_index(term t)
603+
static inline AtomIndex term_to_atom_index(term t)
603604
{
604605
return t >> 6;
605606
}
@@ -611,7 +612,7 @@ static inline int term_to_atom_index(term t)
611612
* @param atom_index global atoms table index.
612613
* @return a term that encapsulates the atom.
613614
*/
614-
static inline term term_from_atom_index(int atom_index)
615+
static inline term term_from_atom_index(AtomIndex atom_index)
615616
{
616617
return TERM_FROM_ATOM_INDEX(atom_index);
617618
}

0 commit comments

Comments
 (0)