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
398e975
..
c9cb275
100755
(executable)
--- a/
swcsa/utils/basics.c
+++ b/
swcsa/utils/basics.c
@@
-1,3
+1,6
@@
+#ifdef __cplusplus
+extern "C" {
+#endif
// Basics
// Basics
@@
-7,9
+10,9
@@
#include <stdlib.h>
// Memory management
#include <stdlib.h>
// Memory management
-
-
void *Malloc (in
t n)
-
+
+
static void *Malloc (size_
t n)
+
{ void *p;
if (n == 0) return NULL;
p = (void*) malloc (n);
{ void *p;
if (n == 0) return NULL;
p = (void*) malloc (n);
@@
-19,14
+22,14
@@
}
return p;
}
}
return p;
}
-
-
void Free (void *p)
-
- { if (p) free (p);
+
+
static
void Free (void *p)
+
+ { if (p) free (p);
}
}
-
-
void *Realloc (void *p, in
t n)
-
+
+
static void *Realloc (void *p, size_
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);
@@
-41,7
+44,7
@@
// 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)
@@
-68,7
+71,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;
@@
-89,7
+92,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;
@@
-105,3
+108,6
@@
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