src/array_list.c

changeset 1047
40aad3f0bc9e
parent 1040
1ecf4dbbc60c
--- a/src/array_list.c	Sun Dec 22 21:57:53 2024 +0100
+++ b/src/array_list.c	Sun Dec 22 22:10:04 2024 +0100
@@ -132,7 +132,7 @@
     size_t oldcap;
     size_t oldsize;
     size_t max_size;
-    if (width == 0 || width == CX_WORDSIZE) {
+    if (width == 0 || width == 8*sizeof(size_t)) {
         oldcap = *(size_t*) capacity;
         oldsize = *(size_t*) size;
         max_size = SIZE_MAX;
@@ -186,7 +186,7 @@
         *array = newmem;
 
         // store new capacity
-        if (width == 0 || width == CX_WORDSIZE) {
+        if (width == 0 || width == 8*sizeof(size_t)) {
             *(size_t*) capacity = newcap;
         } else if (width == 16) {
             *(uint16_t*) capacity = (uint16_t) newcap;
@@ -225,7 +225,7 @@
     size_t oldcap;
     size_t oldsize;
     size_t max_size;
-    if (width == 0 || width == CX_WORDSIZE) {
+    if (width == 0 || width == 8*sizeof(size_t)) {
         oldcap = *(size_t*) capacity;
         oldsize = *(size_t*) size;
         max_size = SIZE_MAX;
@@ -303,7 +303,7 @@
 
     // if any of size or capacity changed, store them back
     if (newsize != oldsize || newcap != oldcap) {
-        if (width == 0 || width == CX_WORDSIZE) {
+        if (width == 0 || width == 8*sizeof(size_t)) {
             *(size_t*) capacity = newcap;
             *(size_t*) size = newsize;
         } else if (width == 16) {

mercurial