10 #if defined(__ANDROID__) 11 #include <android/log.h> 19 for(
t_size walk = 0; walk < count; ++walk) {
20 if (order[walk] >= count)
return false;
21 if (found[walk])
return false;
31 if (value >= count)
return ~0;
32 for(
t_size walk = 0; walk < count; ++walk) {
33 if (order[walk] == value)
return walk;
39 t_size *
const order = p_output;
40 const t_size count = p_count;
44 for(
t_size walk = 0; walk < count; ++walk) {
46 selection[walk] = p_selection[walk];
51 for(;p_delta<0;p_delta++)
54 for(idx=1;idx<count;idx++)
56 if (selection[idx] && !selection[idx-1])
66 for(;p_delta>0;p_delta--)
69 for(idx=count-2;(int)idx>=0;idx--)
71 if (selection[idx] && !selection[idx+1])
85 data[ptr1] = data[ptr2];
92 t_size prev = val, next = order[val];
106 t_size base2 = base+count-1;
108 g_swap(order,base+n,base2-n);
117 #if defined(__ANDROID__) && PFC_DEBUG 129 for(n=0;n<p_bytes>>1;n++)
swap_t(ptr[n],ptr[p_bytes-n-1]);
135 #elif defined(__ANDROID__) 136 __android_log_write(ANDROID_LOG_INFO,
"Debug", msg);
147 _wassert(_Message,_File,_Line);
151 void pfc::myassert(
const char * _Message,
const char *_File,
unsigned _Line)
153 PFC_DEBUGLOG <<
"Assert failure: \"" << _Message <<
"\" in: " << _File <<
" line " << _Line;
183 exp = (unsigned) -expS;
186 exp = (unsigned) expS;
193 if (exp & 1) v *= mul;
200 for(
unsigned i = 0; i < exp; ++i) {
204 if (neg) v = 1.0 / v;
void outputDebugLine(const char *msg)
double exp_int(double base, int exp)
t_uint64 pow_int(t_uint64 base, t_uint64 exp)
void byteswap_raw(void *p_buffer, t_size p_bytes)
Generic variable bit_array implementation. Needs to be initialized with requested array size before ...
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
void set(t_size n, bool val)
static void g_swap(t_size *p_data, t_size ptr1, t_size ptr2)
void printf(const char *,...)
void permutation_validate(t_size const *order, t_size count)
For critical sanity checks. Speed: O(n), allocates memory.
t_size permutation_find_reverse(t_size const *order, t_size count, t_size value)
void set_size(t_size p_size)
static void g_reverse(t_size *order, t_size base, t_size count)
t_int64 rint64(double p_val)
t_int32 rint32(double p_val)
bool permutation_is_valid(t_size const *order, t_size count)
For critical sanity checks. Speed: O(n), allocates memory.
void create_move_items_permutation(t_size *p_output, t_size p_count, const class bit_array &p_selection, int p_delta)
Creates a permutation that moves selected items in a list box by the specified delta-offset.
static t_size g_find_reverse(const t_size *order, t_size val)
Insecure - may deadlock or crash on invalid permutation content. In theory faster than walking the pe...
void myassert(const char *_Message, const char *_File, unsigned _Line)
void swap_t(T &p_item1, T &p_item2)
void myassert_win32(const wchar_t *_Message, const wchar_t *_File, unsigned _Line)
void nixSleep(double seconds)