Create branch new-trunk to track developpement of trunk and allow to make non compati...
[SXSI/TextCollection.git] / swcsa / utils / basics.c
index c9cb275..398e975 100755 (executable)
@@ -1,6 +1,3 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
 
 // Basics
 
@@ -10,9 +7,9 @@ extern "C" {
 #include <stdlib.h>
 
                // Memory management
-
-static void *Malloc (size_t n)
-
+       
+       void *Malloc (int n)
+       
           { void *p;
             if (n == 0) return NULL;
             p = (void*) malloc (n);
@@ -22,14 +19,14 @@ static      void *Malloc (size_t n)
                }
             return p;
           }
-
-static void Free (void *p)
-
-          { if (p) free (p);
+       
+       void Free (void *p)
+       
+          { if (p) free (p); 
           }
-
-static void *Realloc (void *p, size_t n)
-
+       
+       void *Realloc (void *p, int n)
+       
           { if (p == NULL) return Malloc (n);
             if (n == 0) { Free(p); return NULL; }
             p = (void*) realloc (p,n);
@@ -44,7 +41,7 @@ static        void *Realloc (void *p, size_t n)
 
         // bits needed to represent a number between 0 and n
 
-uint _bits (uint n)
+uint bits (uint n)
 
    { uint b = 0;
      while (n)
@@ -71,7 +68,7 @@ uint bitread (uint *e, uint p, uint len)
 
        // writes e[p..p+len-1] = s, len <= W
 
-void bitwrite (register uint *e, register uint p,
+void bitwrite (register uint *e, register uint p, 
               register uint len, register uint s)
 
    { e += p/W; p %= W;
@@ -92,7 +89,7 @@ void bitwrite (register uint *e, register uint p,
    }
        // writes e[p..p+len-1] = 0
 
-void bitzero2 (register uint *e, register uint p,
+void bitzero2 (register uint *e, register uint p, 
               register uint len)
 
    { e += p/W; p %= W;
@@ -108,6 +105,3 @@ void bitzero2 (register uint *e, register uint p,
      if (len > 0)
        *e &= ~(((1<<len)-1)<<p);
    }
-#ifdef __cplusplus
-}
-#endif