39 lines
796 B
C
39 lines
796 B
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <uart.h>
|
|
|
|
uint32_t msb32(uint32_t);
|
|
uint64_t msb64(uint64_t);
|
|
|
|
uint32_t hton32(const uint32_t);
|
|
uint32_t ntoh32(const uint32_t);
|
|
|
|
uint64_t hton64(const uint64_t);
|
|
uint64_t ntoh64(const uint64_t);
|
|
|
|
int isdigit(int);
|
|
int isxdigit(int);
|
|
int isupper(int);
|
|
int isspace(int);
|
|
|
|
int32_t atoi32(const char *);
|
|
uint32_t atoh32(const char *);
|
|
|
|
void exit(int);
|
|
|
|
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
|
#define MAX(x, y) (((x) < (y)) ? (y) : (x))
|
|
|
|
#define ALIGN(ptr, cnt) (void *)((( \
|
|
((uint64_t)(ptr) - 1) >> (cnt)) + 1) << (cnt))
|
|
|
|
#define ALIGN4(ptr) ALIGN(ptr, 2)
|
|
#define ALIGN8(ptr) ALIGN(ptr, 3)
|
|
#define ALIGN4K(ptr) ALIGN(ptr, 12)
|
|
|
|
#define BUMP(orig_type, bump_type, ptr) ( \
|
|
(ptr = (orig_type*)((bump_type*)ptr + 1)), \
|
|
((bump_type*)ptr - 1) \
|
|
)
|