提交 43221080 编写于 作者: B Bernard Xiong

[Kernel] Fix the data type issue in kservice.c

上级 484afe9d
...@@ -133,8 +133,8 @@ void *rt_memset(void *s, int c, rt_ubase_t count) ...@@ -133,8 +133,8 @@ void *rt_memset(void *s, int c, rt_ubase_t count)
return s; return s;
#else #else
#define LBLOCKSIZE (sizeof(rt_int32_t)) #define LBLOCKSIZE (sizeof(long))
#define UNALIGNED(X) ((rt_int32_t)X & (LBLOCKSIZE - 1)) #define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1))
#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
int i; int i;
...@@ -226,11 +226,10 @@ void *rt_memcpy(void *dst, const void *src, rt_ubase_t count) ...@@ -226,11 +226,10 @@ void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
return dst; return dst;
#else #else
#define UNALIGNED(X, Y) \ #define UNALIGNED(X, Y) \
(((rt_int32_t)X & (sizeof(rt_int32_t) - 1)) | \ (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
((rt_int32_t)Y & (sizeof(rt_int32_t) - 1))) #define BIGBLOCKSIZE (sizeof (long) << 2)
#define BIGBLOCKSIZE (sizeof(rt_int32_t) << 2) #define LITTLEBLOCKSIZE (sizeof (long))
#define LITTLEBLOCKSIZE (sizeof(rt_int32_t))
#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE)
char *dst_ptr = (char *)dst; char *dst_ptr = (char *)dst;
...@@ -542,20 +541,20 @@ RTM_EXPORT(rt_show_version); ...@@ -542,20 +541,20 @@ RTM_EXPORT(rt_show_version);
/* private function */ /* private function */
#define isdigit(c) ((unsigned)((c) - '0') < 10) #define isdigit(c) ((unsigned)((c) - '0') < 10)
rt_inline rt_int32_t divide(rt_int32_t *n, rt_int32_t base) rt_inline int divide(long *n, int base)
{ {
rt_int32_t res; int res;
/* optimized for processor which does not support divide instructions. */ /* optimized for processor which does not support divide instructions. */
if (base == 10) if (base == 10)
{ {
res = ((rt_uint32_t) * n) % 10U; res = (int)(((unsigned long)*n) % 10U);
*n = ((rt_uint32_t) * n) / 10U; *n = (long)(((unsigned long)*n) / 10U);
} }
else else
{ {
res = ((rt_uint32_t) * n) % 16U; res = (int)(((unsigned long)*n) % 16U);
*n = ((rt_uint32_t) * n) / 16U; *n = (long)(((unsigned long)*n) / 16U);
} }
return res; return res;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册