mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
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
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user