mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-09-20 03:18:13 +08:00
34 lines
884 B
C
34 lines
884 B
C
#ifndef HA_UTILS_H
|
|
#define HA_UTILS_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef MALLOC
|
|
#define MALLOC(ptr, len) ((ptr) = (__typeof__(ptr))malloc((len) * sizeof(*(ptr))))
|
|
#endif
|
|
#ifndef CALLOC
|
|
#define CALLOC(ptr, len) ((ptr) = (__typeof__(ptr))calloc((len), sizeof(*(ptr))))
|
|
#endif
|
|
#ifndef REALLOC
|
|
#define REALLOC(ptr, len) ((ptr) = (__typeof__(ptr))realloc((ptr), (len) * sizeof(*(ptr))))
|
|
#endif
|
|
|
|
#ifndef kroundup32
|
|
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
|
|
#endif
|
|
|
|
#ifndef kroundup64
|
|
#define kroundup64(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, x|=(x)>>32, ++(x))
|
|
#endif
|
|
|
|
void radix_sort_ha64(uint64_t *st, uint64_t *en);
|
|
|
|
double yak_cputime(void);
|
|
void yak_reset_realtime(void);
|
|
double yak_realtime(void);
|
|
long yak_peakrss(void);
|
|
double yak_peakrss_in_gb(void);
|
|
double yak_cpu_usage(void);
|
|
|
|
#endif
|