| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /******************************************************************************
- 版权所有:
- 文件名称: rt_clib.h
- 文件版本: 01.01
- 创建作者: sunxi
- 创建日期: 2020-03-30
- 功能说明: 标准C库的接口.
- 其它说明:
- 修改记录:
- */
- #ifndef _RT_CLIB_H
- #define _RT_CLIB_H
- /*------------------------------- 头文件 --------------------------------------
- */
- #include "limits.h"
- /*------------------------------- 宏定义 --------------------------------------
- */
- // linux内核中的sprintf不支持浮点打印
- // rt_sprintf支持浮点打印。
- #define rt_sprintf sprintf
- // 正负浮点数四舍五入,float double类型自适应
- #define rt_round(f) ((f < 0) ? (f - 0.5) : (f + 0.5))
- #if 1
- // #define USHORT_MAX ((unsigned short)(~0U))
- // #define SHORT_MAX ((signed short)(USHORT_MAX>>1))
- #define SHORT_MIN (-SHORT_MAX - 1)
- #if 0 // sunxi 20220425 csky-toolchain/lib/gcc/csky-linux-gnuabiv2/6.3.0/include-fixed/limits.h 已经定义了
- #define INT_MAX ((int)(~0U >> 1))
- #define INT_MIN (-INT_MAX - 1)
- #define UINT_MAX (~0U)
- #define LONG_MAX ((long)(~0UL >> 1))
- #define LONG_MIN (-LONG_MAX - 1)
- #define ULONG_MAX (~0UL)
- #define LLONG_MAX ((long long)(~0ULL >> 1))
- #define LLONG_MIN (-LLONG_MAX - 1)
- #define ULLONG_MAX (~0ULL)
- #endif
- #endif
- /*------------------------------ 类型结构 -------------------------------------
- */
- /*------------------------------ 函数声明 -------------------------------------
- */
- #if 0
- void abort(void);
- void * bsearch(const void *key, const void *base0, int nmemb, int size, int (*compar)(const void *, const void *));
- long strtol(const char *nptr, char **endptr, int base);
- unsigned long strtoul(const char *nptr, char **endptr, int base);
- long atol(const char *str);
- long atoi(const char *str);
- #endif
- float sqrtf(float x);
- float atan2f(float y, float x);
- int rt_sprintf(char *buf, const char *fmt, ...);
- void swap32(void *p);
- void swap16(void *p);
- #endif //_RT_CLIB_H
- /*------------------------------ 文件结束 -------------------------------------
- */
|