Fix single-file build by defining GRADE_UD in selfsearch.c

This commit is contained in:
Marshall Lochbaum 2022-10-24 22:08:28 -04:00
parent 2844520109
commit 9862331696
2 changed files with 5 additions and 5 deletions

View File

@ -2,12 +2,10 @@
// Radix sorting utilities
// These are leaky macros and assume counts are c0, c1,...
// which must be adjacent in memory
// which must be adjacent in memory. Search functions will also need
// #define GRADE_UD(U,D) U
// to do the appropriate sums for an ascending radix sort.
#ifndef GRADE_UD
// Search functions need this: they always sort up
#define GRADE_UD(U,D) U
#endif
#define RDX_PRE(K) s##K=c##K[j]+=s##K
#define RDX_SUM_1(T) T s0=0; for(usz j=0;j<256;j++) { RDX_PRE(0); }
#define RDX_SUM_2(T) GRADE_UD(c1[0]=0;,) T s0=0, s1=0; for(usz j=0;j<256;j++) { RDX_PRE(0); RDX_PRE(1); }

View File

@ -6,6 +6,7 @@
B not_c1(B t, B x);
B shape_c1(B t, B x);
#define GRADE_UD(U,D) U
#include "radix.h"
u8 radix_offsets_2_u32(usz* c0, u32* v0, usz n) {
usz rx = 256;
@ -19,6 +20,7 @@ u8 radix_offsets_2_u32(usz* c0, u32* v0, usz n) {
if ((c0+1)[(u8)(v>>16)] < n) { RADIX_SUM_1_u32; return 1; }
return 0;
}
#undef GRADE_UD
#define RADIX_LOOKUP_32(INIT, SETTAB) \
u8 bytes = radix_offsets_2_u32(c0, v0, n); \
usz tim = tn/(64/sizeof(*tab)); /* sparse table init max */ \