changeset 32:53ae0f7d8aa1

atom: Redefine
author Lewin Bormann <lbo@spheniscida.de>
date Wed, 21 Aug 2019 10:50:23 +0200
parents 57fb1b70b990
children 4f7fdf333a42
files src/atom.c src/atom.h
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/atom.c	Tue Aug 20 19:47:46 2019 +0200
+++ b/src/atom.c	Wed Aug 21 10:50:23 2019 +0200
@@ -10,11 +10,11 @@
 #include <string.h>
 
 // TODO: Adjust this later.
-static const size_t YATOM_MAX_NUM_ATOMS = 1024;
-static const unsigned long long YATOM_COUNTER_OFFSET = 0xa0a0a0a0a0;
+static const size_t YATOM_MAX_NUM_ATOMS = 256;
+static const uint64_t YATOM_COUNTER_OFFSET = 0xa0a0a0a0a0;
 
 static bool yatom_table_initialized = false;
-// Table from atom name to atom id.
+// Table from atom name to atom id. This is not in the hot path of important functions!
 static struct hsearch_data yatom_table;
 static yvec_t yatom_ids; // Vector of const char*.
 static yatom_t yatom_counter =
--- a/src/atom.h	Tue Aug 20 19:47:46 2019 +0200
+++ b/src/atom.h	Wed Aug 21 10:50:23 2019 +0200
@@ -1,6 +1,8 @@
 #ifndef src_atom_h
 #define src_atom_h
 
+#include <stdint.h>
+
 /**
  * @file atom.h
  * @addtogroup language
@@ -11,7 +13,7 @@
  * Atom identifier - identifies an atom in the global atoms table. IDs are
  * unique and can be compared using numeric equality.
  */
-typedef unsigned long long yatom_t;
+typedef uint64_t yatom_t;
 
 /**
  * Find the ID of the named atom or allocate a new one.