📄 uclib.h
字号:
#ifndef __UCLIB_H__
#define __UCLIB_H__
extern "C"
{
unsigned int alloc(unsigned int nbytes);
unsigned int Drv_realloc(unsigned int address,unsigned int nbytes);
void deAlloc(unsigned int address);
unsigned int Drv_calloc(unsigned int size,unsigned int n);
}
typedef struct
{
int quot; /* Quotient. */
int rem; /* Remainder. */
} div_t;
/* */
#define div(a, b) \
({ \
div_t result; \
result.quot = a / b; \
result.rem = a - (result.quot * b); \
result; \
})
#define abs(a) (((a) < 0) ? -(a) : (a))
/*
#define malloc(x) (void *)alloc(x)
#define free(x) deAlloc((unsigned int)x)
#define calloc(x,n) (void *)Drv_calloc(x,n)
#define realloc(x,size) ((void *)Drv_realloc((unsigned int)x,(unsigned int)size))
*/
#define LocalAlloc(x,size) (void *)alloc(size)
#define LocalFree(x) deAlloc(()unsigned int)x)
#ifdef __cplusplus
/*
void * operator new(unsigned int size)
{
//printf("image new...\n");
void *p = malloc(size);
return (p);
}
void operator delete(void *p)
{
free(p);
}
void *operator new[](unsigned int size)
{
//printf("image new[]...\n");
void *p = malloc(size);
return (p);
}
void operator delete[](void *p)
{
free(p);
}
*/
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -