forked from urjaman/fernly
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.h
20 lines (17 loc) · 755 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef __UTILS_H__
#define __UTILS_H__
#include <stdint.h>
# define do_div(n,base) ({ \
uint32_t __base = (base); \
uint32_t __rem; \
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
if (((n) >> 32) == 0) { \
__rem = (uint32_t)(n) % __base; \
(n) = (uint32_t)(n) / __base; \
} else \
__rem = __div64_32(&(n), __base); \
__rem; \
})
uint32_t _udiv64(uint64_t n, uint32_t d);
uint32_t __div64_32(uint64_t *n, uint32_t base);
#endif /* __UTILS_H__ */