about summary refs log tree commit diff
path: root/locale/programs/3level.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-07 18:55:12 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-07 18:55:12 +0000
commit48ddeb0b4c82cd33bea3e77e254e36cac52338ed (patch)
tree1e9efc2293afbcccb80a4a6b4b5897940e2cf8dc /locale/programs/3level.h
parentf2ef916340957d7bf9fafbe1cfefc8c6361a3af8 (diff)
downloadglibc-48ddeb0b4c82cd33bea3e77e254e36cac52338ed.tar.gz
glibc-48ddeb0b4c82cd33bea3e77e254e36cac52338ed.tar.xz
glibc-48ddeb0b4c82cd33bea3e77e254e36cac52338ed.zip
Update.
	    Andreas Schwab  <schwab@suse.de>
	    Bruno Haible  <haible@clisp.cons.org>

	* locale/programs/3level.h (EMPTY): New macro.
	(*_get, *_add, *_iterate, *_finalize): Use it instead of ~(uint32_t) 0.

2001-08-08  GOTO Masanori  <gotom@debian.or.jp>

	* locale/iso-3166.def: Updates from latest official list.

2001-08-07  Andreas Jaeger  <aj@suse.de>
	* iconv/gconv_charset.h (upstr): Add unused attribute to avoid warning.
	* libio/iopopen.c (_IO_new_proc_open): Fix typos, it's _IO_MTSAFE_IO.
Diffstat (limited to 'locale/programs/3level.h')
-rw-r--r--locale/programs/3level.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/locale/programs/3level.h b/locale/programs/3level.h
index d96546635a..f4d641d67c 100644
--- a/locale/programs/3level.h
+++ b/locale/programs/3level.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
 
@@ -74,6 +74,10 @@ CONCAT(TABLE,_init) (struct TABLE *t)
   t->level3_alloc = t->level3_size = 0;
 }
 
+/* Marker for an empty slot.  This has the value 0xFFFFFFFF, regardless
+   whether 'int' is 16 bit, 32 bit, or 64 bit.  */
+#define EMPTY ((uint32_t) ~0)
+
 /* Retrieve an entry.  */
 static inline ELEMENT
 CONCAT(TABLE,_get) (struct TABLE *t, uint32_t wc)
@@ -82,12 +86,12 @@ CONCAT(TABLE,_get) (struct TABLE *t, uint32_t wc)
   if (index1 < t->level1_size)
     {
       uint32_t lookup1 = t->level1[index1];
-      if (lookup1 != ~((uint32_t) 0))
+      if (lookup1 != EMPTY)
 	{
 	  uint32_t index2 = ((wc >> t->p) & ((1 << t->q) - 1))
 			    + (lookup1 << t->q);
 	  uint32_t lookup2 = t->level2[index2];
-	  if (lookup2 != ~((uint32_t) 0))
+	  if (lookup2 != EMPTY)
 	    {
 	      uint32_t index3 = (wc & ((1 << t->p) - 1))
 				+ (lookup2 << t->p);
@@ -124,10 +128,10 @@ CONCAT(TABLE,_add) (struct TABLE *t, uint32_t wc, ELEMENT value)
 	  t->level1_alloc = alloc;
 	}
       while (index1 >= t->level1_size)
-	t->level1[t->level1_size++] = ~((uint32_t) 0);
+	t->level1[t->level1_size++] = EMPTY;
     }
 
-  if (t->level1[index1] == ~((uint32_t) 0))
+  if (t->level1[index1] == EMPTY)
     {
       if (t->level2_size == t->level2_alloc)
 	{
@@ -139,13 +143,13 @@ CONCAT(TABLE,_add) (struct TABLE *t, uint32_t wc, ELEMENT value)
       i1 = t->level2_size << t->q;
       i2 = (t->level2_size + 1) << t->q;
       for (i = i1; i < i2; i++)
-	t->level2[i] = ~((uint32_t) 0);
+	t->level2[i] = EMPTY;
       t->level1[index1] = t->level2_size++;
     }
 
   index2 += t->level1[index1] << t->q;
 
-  if (t->level2[index2] == ~((uint32_t) 0))
+  if (t->level2[index2] == EMPTY)
     {
       if (t->level3_size == t->level3_alloc)
 	{
@@ -176,14 +180,14 @@ CONCAT(TABLE,_iterate) (struct TABLE *t,
   for (index1 = 0; index1 < t->level1_size; index1++)
     {
       uint32_t lookup1 = t->level1[index1];
-      if (lookup1 != ~((uint32_t) 0))
+      if (lookup1 != EMPTY)
 	{
 	  uint32_t lookup1_shifted = lookup1 << t->q;
 	  uint32_t index2;
 	  for (index2 = 0; index2 < (1 << t->q); index2++)
 	    {
 	      uint32_t lookup2 = t->level2[index2 + lookup1_shifted];
-	      if (lookup2 != ~((uint32_t) 0))
+	      if (lookup2 != EMPTY)
 		{
 		  uint32_t lookup2_shifted = lookup2 << t->p;
 		  uint32_t index3;
@@ -232,7 +236,7 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
   t->level3_size = k;
 
   for (i = 0; i < (t->level2_size << t->q); i++)
-    if (t->level2[i] != ~((uint32_t) 0))
+    if (t->level2[i] != EMPTY)
       t->level2[i] = reorder3[t->level2[i]];
 
   /* Uniquify level2 blocks.  */
@@ -256,7 +260,7 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
   t->level2_size = k;
 
   for (i = 0; i < t->level1_size; i++)
-    if (t->level1[i] != ~((uint32_t) 0))
+    if (t->level1[i] != EMPTY)
       t->level1[i] = reorder2[t->level1[i]];
 
   /* Create and fill the resulting compressed representation.  */
@@ -286,13 +290,13 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
 
   for (i = 0; i < t->level1_size; i++)
     ((uint32_t *) (t->result + level1_offset))[i] =
-      (t->level1[i] == ~((uint32_t) 0)
+      (t->level1[i] == EMPTY
        ? 0
        : (t->level1[i] << t->q) * sizeof (uint32_t) + level2_offset);
 
   for (i = 0; i < (t->level2_size << t->q); i++)
     ((uint32_t *) (t->result + level2_offset))[i] =
-      (t->level2[i] == ~((uint32_t) 0)
+      (t->level2[i] == EMPTY
        ? 0
        : (t->level2[i] << t->p) * sizeof (ELEMENT) + level3_offset);
 
@@ -311,6 +315,7 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
 }
 #endif
 
+#undef EMPTY
 #undef TABLE
 #undef ELEMENT
 #undef DEFAULT