-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
we can format this a sa pr later, but it is this thing:
unsigned long long count_double(char *str) {
char *i, c1, c2;
unsigned long long count = 0;
c1 = *str;
c2 = *(str + 1);
for(i = str+1; c2 = *i; i++) {
count += (c1 == c2);
c1 = c2;
}
return count;
}
Build with:
gcc -shared -o libblacount.so -fPIC blacount.c
And prepare to use from Python with:
import ctypes
blacount = ctypes.cdll.LoadLibrary("./libblacount.so")
blacount.count_double.argtypes = [ctypes.c_char_p]
blacount.count_double.restype = ctypes.c_uint64
(it counts byte-strings only)
rochacbruno
Metadata
Metadata
Assignees
Labels
No labels