aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/builtins.h
diff options
context:
space:
mode:
authorAndrew Gierth <rhodiumtoad@postgresql.org>2020-02-01 21:57:14 +0000
committerAndrew Gierth <rhodiumtoad@postgresql.org>2020-02-01 21:57:14 +0000
commit1fd687a035558238c0e3cab09fc22dc61a088869 (patch)
treea1bb4aeffc21f7fc0e96f7d86d0b80c5c3b0ab8c /src/include/utils/builtins.h
parent7bae0ad9fcb76b28410571dc71edfdc3175c4a02 (diff)
downloadpostgresql-1fd687a035558238c0e3cab09fc22dc61a088869.tar.gz
postgresql-1fd687a035558238c0e3cab09fc22dc61a088869.zip
Optimizations for integer to decimal output.
Using a lookup table of digit pairs reduces the number of divisions needed, and calculating the length upfront saves some work; these ideas are taken from the code previously committed for floats. David Fetter, reviewed by Kyotaro Horiguchi, Tels, and me. Discussion: https://postgr.es/m/20190924052620.GP31596%40fetter.org
Diffstat (limited to 'src/include/utils/builtins.h')
-rw-r--r--src/include/utils/builtins.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index a241af4bdf9..e2016a8bc2d 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -18,6 +18,8 @@
#include "nodes/nodes.h"
#include "utils/fmgrprotos.h"
+/* Sign + the most decimal digits an 8-byte number could have */
+#define MAXINT8LEN 20
/* bool.c */
extern bool parse_bool(const char *value, bool *result);
@@ -46,10 +48,12 @@ extern int32 pg_atoi(const char *s, int size, int c);
extern int16 pg_strtoint16(const char *s);
extern int32 pg_strtoint32(const char *s);
extern void pg_itoa(int16 i, char *a);
+int pg_ultoa_n(uint32 l, char *a);
+int pg_ulltoa_n(uint64 l, char *a);
extern void pg_ltoa(int32 l, char *a);
extern void pg_lltoa(int64 ll, char *a);
-extern char *pg_ltostr_zeropad(char *str, int32 value, int32 minwidth);
-extern char *pg_ltostr(char *str, int32 value);
+extern char *pg_ultostr_zeropad(char *str, uint32 value, int32 minwidth);
+extern char *pg_ultostr(char *str, uint32 value);
extern uint64 pg_strtouint64(const char *str, char **endptr, int base);
/* oid.c */