projects
/
SXSI
/
TextCollection.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Create branch new-trunk to track developpement of trunk and allow to make non compati...
[SXSI/TextCollection.git]
/
swcsa
/
utils
/
basics.c
diff --git
a/swcsa/utils/basics.c
b/swcsa/utils/basics.c
index
c9cb275
..
398e975
100755
(executable)
--- a/
swcsa/utils/basics.c
+++ b/
swcsa/utils/basics.c
@@
-1,6
+1,3
@@
-#ifdef __cplusplus
-extern "C" {
-#endif
// Basics
// Basics
@@
-10,9
+7,9
@@
extern "C" {
#include <stdlib.h>
// Memory management
#include <stdlib.h>
// Memory management
-
-
static void *Malloc (size_
t n)
-
+
+
void *Malloc (in
t n)
+
{ void *p;
if (n == 0) return NULL;
p = (void*) malloc (n);
{ void *p;
if (n == 0) return NULL;
p = (void*) malloc (n);
@@
-22,14
+19,14
@@
static void *Malloc (size_t n)
}
return p;
}
}
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, in
t n)
+
{ if (p == NULL) return Malloc (n);
if (n == 0) { Free(p); return NULL; }
p = (void*) realloc (p,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
// bits needed to represent a number between 0 and n
-uint
_
bits (uint n)
+uint bits (uint n)
{ uint b = 0;
while (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
// 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;
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
}
// 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;
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);
}
if (len > 0)
*e &= ~(((1<<len)-1)<<p);
}
-#ifdef __cplusplus
-}
-#endif