Initial import of libucore

This commit is contained in:
Nils O. Selåsdal
2012-10-29 23:07:32 +01:00
commit ed3866e49a
79 changed files with 6181 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#ifndef UCORE_MATH_H_
#define UCORE_MATH_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
uint32_t
uc_gcd_32(uint32_t a, uint32_t b);
uint64_t
uc_gcd_64(uint64_t a, uint64_t b);
uint32_t
uc_phi_32(uint32_t N);
uint64_t
uc_phi_64(uint64_t N);
static inline uint32_t
uc_nextpow2(uint32_t x)
{
x--;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x++;
return x;
}
#ifdef __cplusplus
}
#endif
#endif