23 lines
773 B
C
23 lines
773 B
C
/* radare - LGPL - Copyright 2014 - crowell */
|
|
|
|
#ifndef R_DEBRUIJN_H
|
|
#define R_DEBRUIJN_H
|
|
|
|
#include <r_types.h>
|
|
|
|
// For information about the algorithm, see Joe Sawada and Frank Ruskey, "An
|
|
// Efficient Algorithm for Generating Necklaces with Fixed Density"
|
|
|
|
// Generate a cyclic pattern of desired size, and charset, return with starting
|
|
// offset of start.
|
|
// The returned string is malloced, and it is the responsibility of the caller
|
|
// to free the memory.
|
|
R_API char* r_debruijn_pattern(int size, int start, const char* charset);
|
|
|
|
|
|
// Finds the offset of a given value in a cyclic pattern of an integer.
|
|
// Guest endian = 1 if little, 0 if big.
|
|
// Host endian = 1 if little, 0 if big.
|
|
R_API int r_debruijn_offset(ut64 value, int guest_endian);
|
|
|
|
#endif // R_DEBRUIJN_H
|