12 static const char *
debruijn_charset =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
15 static void de_bruijn_seq(
int prenecklace_len_t,
int lyndon_prefix_len_p,
int order,
16 int maxlen,
int size,
int *prenecklace_a,
char *sequence,
const char *charset) {
18 if (!charset || !sequence || strlen(sequence) ==
maxlen) {
21 if (prenecklace_len_t > order) {
22 if (order % lyndon_prefix_len_p == 0) {
23 for (j = 1; j <= lyndon_prefix_len_p; j++) {
24 sequence[strlen(sequence)] = charset[prenecklace_a[j]];
25 if (strlen(sequence) ==
maxlen) {
31 prenecklace_a[prenecklace_len_t] =
32 prenecklace_a[prenecklace_len_t - lyndon_prefix_len_p];
34 size, prenecklace_a, sequence, charset);
35 for (j = prenecklace_a[prenecklace_len_t - lyndon_prefix_len_p] + 1;
37 prenecklace_a[prenecklace_len_t] = j;
39 size, prenecklace_a, sequence, charset);
51 size_t size = strlen(charset);
52 int *prenecklace_a =
calloc(
size * (
size_t)order,
sizeof(
int));
87 if (!pat ||
start == 0) {
98 strcpy(pat2, pat +
start);
116 int lens[] = { 0x1000, 0x10000, 0x100000 };
137 for (needle =
buf; !*needle; needle++) {
141 char *pch = strstr(pattern, needle);
143 retval = (
int)(
size_t)(pch - pattern);
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
static void de_bruijn_seq(int prenecklace_len_t, int lyndon_prefix_len_p, int order, int maxlen, int size, int *prenecklace_a, char *sequence, const char *charset)
static char * de_bruijn(const char *charset, int order, int maxlen)
RZ_API int rz_debruijn_offset(int start, const char *charset, ut64 value, bool is_big_endian)
Finds the offset of a given value in a debrujn sequence.
RZ_API RZ_OWN char * rz_debruijn_pattern(int size, int start, const char *charset)
Generate a cyclic pattern following the Debruijn pattern.
static const char * debruijn_charset
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * calloc(size_t number, size_t size)
bool MACH0_() is_big_endian(struct MACH0_(obj_t) *bin)
#define rz_return_val_if_fail(expr, val)
static void rz_write_be64(void *dest, ut64 val)
static void rz_write_le64(void *dest, ut64 val)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()