32 lines
717 B
C
32 lines
717 B
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <uart.h>
|
|
|
|
uint32_t msb32(uint32_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 ALIGN4(ptr) (void *)(((((uint64_t)(ptr) - 1) >> 2) + 1) << 2)
|
|
#define ALIGN8(ptr) (void *)(((((uint64_t)(ptr) - 1) >> 3) + 1) << 3)
|
|
#define BUMP(orig_type, bump_type, ptr) ( \
|
|
(ptr = (orig_type *)((bump_type *)ptr + 1)), \
|
|
((bump_type *)ptr - 1) \
|
|
)
|