2 * Copyright (c) 2016 by Delphix. All rights reserved.
5 #include <sys/lua/lua.h>
9 lcompat_sprintf(char *buf
, size_t size
, const char *fmt
, ...)
15 res
= vsnprintf(buf
, size
, fmt
, args
);
22 lcompat_strtoll(const char *str
, char **ptr
)
28 boolean_t is_negative
;
31 while (*cp
== ' ' || *cp
== '\t' || *cp
== '\n') {
34 is_negative
= (*cp
== '-');
43 if (*cp
== 'x' || *cp
== 'X') {
50 for (; *cp
!= '\0'; cp
++) {
51 if (*cp
>= '0' && *cp
<= '9') {
53 } else if (*cp
>= 'a' && *cp
<= 'f') {
54 digits
= *cp
- 'a' + 10;
55 } else if (*cp
>= 'A' && *cp
<= 'F') {
56 digits
= *cp
- 'A' + 10;
63 value
= (value
* base
) + digits
;
76 lcompat_pow(int64_t x
, int64_t y
)
92 lcompat_hashnum(int64_t x
)