summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Locale/_wcstoul.h
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib/LibC/Locale/_wcstoul.h')
-rw-r--r--StdLib/LibC/Locale/_wcstoul.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/StdLib/LibC/Locale/_wcstoul.h b/StdLib/LibC/Locale/_wcstoul.h
index ebfc330fe9..2131d4b5c1 100644
--- a/StdLib/LibC/Locale/_wcstoul.h
+++ b/StdLib/LibC/Locale/_wcstoul.h
@@ -42,6 +42,8 @@
NetBSD: _wcstoul.h,v 1.3 2005/11/29 03:11:59 christos Exp
*/
+#include <Library/BaseLib.h>
+
/*
* function template for wcstoul, wcstoull and wcstoumax.
*
@@ -102,8 +104,8 @@ _FUNCNAME(
/*
* See strtoul for comments as to the logic used.
*/
- cutoff = __wUINT_MAX / (__wUINT)base;
- cutlim = (int)(__wUINT_MAX % (__wUINT)base);
+ cutoff = (__wUINT)DivU64x32 ((UINT64) __wUINT_MAX, (UINT32) base);
+ cutlim = (int) ModU64x32 ((UINT64) __wUINT_MAX, (UINT32) base);
for (acc = 0, any = 0;; wc = (wint_t) *s++) {
i = __wctoint((wchar_t)wc);
if (i == -1) {