struct fastbuf *sbuck_read(struct sort_bucket *b);
struct fastbuf *sbuck_write(struct sort_bucket *b);
void sbuck_swap_out(struct sort_bucket *b);
-
-#define F_SIZE(x) ({ byte buf[16]; format_size(buf, x); buf; })
-#define F_BSIZE(b) F_SIZE(sbuck_size(b))
void format_size(byte *buf, u64 x);
#endif
#include <string.h>
#include <sys/time.h>
#include <time.h>
+#include <alloca.h>
+
+#define F_SIZE(x) ({ byte *buf = alloca(16); format_size(buf, x); buf; })
+#define F_BSIZE(b) F_SIZE(sbuck_size(b))
static u64
sorter_clock(void)
SORT_XTRACE(2, "Running radix sort on %s with %d bits of %d", F_BSIZE(b), bits, b->hash_bits);
sorter_start_timer(ctx);
- struct sort_bucket *outs[nbuck];
+ struct sort_bucket **outs = alloca(nbuck * sizeof(struct sort_bucket *));
for (uns i=nbuck; i--; )
{
outs[i] = sbuck_new(ctx);
ctx->radix_split(ctx, b, outs, b->hash_bits - bits, bits);
- u64 min = ~0U, max = 0, sum = 0;
+ u64 min = ~(u64)0, max = 0, sum = 0;
for (uns i=0; i<nbuck; i++)
{
u64 s = sbuck_size(outs[i]);