summaryrefslogtreecommitdiff
path: root/itoa_ljust.h
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2016-12-30 17:23:18 -0800
committerdormando <dormando@rydia.net>2017-01-07 18:22:56 -0800
commit1cc77e6824c3dc9dc5f1ba679df9a49fc3cbeff3 (patch)
treef7b4e39303ba893f6a3e1f6b0ded5b3b172d267b /itoa_ljust.h
parentd9dfbe0e2613b9c20cb3c4fdd3c55d1bf3a8c8bd (diff)
downloadmemcached-1cc77e6824c3dc9dc5f1ba679df9a49fc3cbeff3.tar.gz
import itoa_ljust.c for fast number printing
converted from C++. for best speed, needs to be built with O3
Diffstat (limited to 'itoa_ljust.h')
-rw-r--r--itoa_ljust.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/itoa_ljust.h b/itoa_ljust.h
new file mode 100644
index 0000000..18fc94d
--- /dev/null
+++ b/itoa_ljust.h
@@ -0,0 +1,28 @@
+#ifndef ITOA_LJUST_H
+#define ITOA_LJUST_H
+
+//=== itoa_ljust.h - Fast integer to ascii conversion
+//
+// Fast and simple integer to ASCII conversion:
+//
+// - 32 and 64-bit integers
+// - signed and unsigned
+// - user supplied buffer must be large enough for all decimal digits
+// in value plus minus sign if negative
+// - left-justified
+// - NUL terminated
+// - return value is pointer to NUL terminator
+//
+// Copyright (c) 2016 Arturo Martin-de-Nicolas
+// arturomdn@gmail.com
+// https://github.com/amdn/itoa_ljust/
+//===----------------------------------------------------------------------===//
+
+#include <stdint.h>
+
+char* itoa_u32(uint32_t u, char* buffer);
+char* itoa_32( int32_t i, char* buffer);
+char* itoa_u64(uint64_t u, char* buffer);
+char* itoa_64( int64_t i, char* buffer);
+
+#endif // ITOA_LJUST_H