chiark / gitweb /
src/noise.c: Make `bitcount' table be static and constant.
[catacomb] / rand / noise.c
index 3969b4e441b03cc30cf5edaff4b44b3d2c6573e6..ee2adcce08bbf5c402203a7d299a860e62f37746 100644 (file)
@@ -87,8 +87,8 @@ static gid_t noise_gid = NOISE_NOSETGID; /* Gid to set to spawn processes */
 
 static int bitcount(unsigned long x)
 {
-  char ctab[] = { 0, 1, 1, 2, 1, 2, 2, 3,
-                 1, 2, 2, 3, 2, 3, 3, 4 };
+  static const char ctab[] = { 0, 1, 1, 2, 1, 2, 2, 3,
+                              1, 2, 2, 3, 2, 3, 3, 4 };
   int count = 0;
   while (x) {
     count += ctab[x & 0xfu];