mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Use inline function instead of macro.
svn path=/trunk/; revision=16803
This commit is contained in:
parent
5af8e51ad1
commit
52973bb61c
2 changed files with 22 additions and 19 deletions
|
@ -20,14 +20,7 @@
|
||||||
* Wirzenius wrote this portably, Torvalds fucked it up :-)
|
* Wirzenius wrote this portably, Torvalds fucked it up :-)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __NO_CTYPE_INLINES
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include <ntdll.h>
|
#include <ntdll.h>
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define ZEROPAD 1 /* pad with zero */
|
#define ZEROPAD 1 /* pad with zero */
|
||||||
#define SIGN 2 /* unsigned/signed long */
|
#define SIGN 2 /* unsigned/signed long */
|
||||||
|
@ -38,11 +31,16 @@
|
||||||
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
||||||
|
|
||||||
|
|
||||||
#define do_div(n,base) ({ \
|
static
|
||||||
int __res; \
|
__inline
|
||||||
__res = ((unsigned long long) n) % (unsigned) base; \
|
int
|
||||||
n = ((unsigned long long) n) / (unsigned) base; \
|
do_div(long long *n, int base)
|
||||||
__res; })
|
{
|
||||||
|
int a;
|
||||||
|
a = ((unsigned long long) *n) % (unsigned) base;
|
||||||
|
*n = ((unsigned long long) *n) / (unsigned) base;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int skip_atoi(const char **s)
|
static int skip_atoi(const char **s)
|
||||||
|
@ -94,7 +92,7 @@ number(char * buf, char * end, long long num, int base, int size, int precision,
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
tmp[i++]='0';
|
tmp[i++]='0';
|
||||||
else while (num != 0)
|
else while (num != 0)
|
||||||
tmp[i++] = digits[do_div(num,base)];
|
tmp[i++] = digits[do_div(&num,base)];
|
||||||
if (i > precision)
|
if (i > precision)
|
||||||
precision = i;
|
precision = i;
|
||||||
size -= precision;
|
size -= precision;
|
||||||
|
|
|
@ -37,11 +37,16 @@
|
||||||
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
||||||
|
|
||||||
|
|
||||||
#define do_div(n,base) ({ \
|
static
|
||||||
int __res; \
|
__inline
|
||||||
__res = ((unsigned long long) n) % (unsigned) base; \
|
int
|
||||||
n = ((unsigned long long) n) / (unsigned) base; \
|
do_div(long long *n, int base)
|
||||||
__res; })
|
{
|
||||||
|
int a;
|
||||||
|
a = ((unsigned long long) *n) % (unsigned) base;
|
||||||
|
*n = ((unsigned long long) *n) / (unsigned) base;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int skip_atoi(const wchar_t **s)
|
static int skip_atoi(const wchar_t **s)
|
||||||
|
@ -93,7 +98,7 @@ number(wchar_t * buf, wchar_t * end, long long num, int base, int size, int prec
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
tmp[i++] = L'0';
|
tmp[i++] = L'0';
|
||||||
else while (num != 0)
|
else while (num != 0)
|
||||||
tmp[i++] = digits[do_div(num,base)];
|
tmp[i++] = digits[do_div(&num,base)];
|
||||||
if (i > precision)
|
if (i > precision)
|
||||||
precision = i;
|
precision = i;
|
||||||
size -= precision;
|
size -= precision;
|
||||||
|
|
Loading…
Reference in a new issue