aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/strings/numbers.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-04-05 14:42:45 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-04-05 15:51:36 -0700
commit1d004f969867ee38c5398d68574e141ce8de86cb (patch)
treea10822e17b47992312f87043e508b967a7519569 /tensorflow/core/lib/strings/numbers.h
parenta8f0dd875b86e0dcefbd978441f79c51f3cc241e (diff)
Add safe_strtou32, safe_strtou64, and safe_strtod to numbers.h.
Change: 119099796
Diffstat (limited to 'tensorflow/core/lib/strings/numbers.h')
-rw-r--r--tensorflow/core/lib/strings/numbers.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tensorflow/core/lib/strings/numbers.h b/tensorflow/core/lib/strings/numbers.h
index 68ddc68ebb..69a9a78fde 100644
--- a/tensorflow/core/lib/strings/numbers.h
+++ b/tensorflow/core/lib/strings/numbers.h
@@ -97,16 +97,31 @@ bool HexStringToUint64(const StringPiece& s, uint64* v);
// Return false with overflow or invalid input.
bool safe_strto32(StringPiece str, int32* value);
+// Convert strings to unsigned 32bit integer values.
+// Leading and trailing spaces are allowed.
+// Return false with overflow or invalid input.
+bool safe_strtou32(StringPiece str, uint32* value);
+
// Convert strings to 64bit integer values.
// Leading and trailing spaces are allowed.
// Return false with overflow or invalid input.
bool safe_strto64(StringPiece str, int64* value);
+// Convert strings to unsigned 64bit integer values.
+// Leading and trailing spaces are allowed.
+// Return false with overflow or invalid input.
+bool safe_strtou64(StringPiece str, uint64* value);
+
// Convert strings to floating point values.
// Leading and trailing spaces are allowed.
// Values may be rounded on over- and underflow.
bool safe_strtof(const char* str, float* value);
+// Convert strings to double precision floating point values.
+// Leading and trailing spaces are allowed.
+// Values may be rounded on over- and underflow.
+bool safe_strtod(const char* str, double* value);
+
// Converts from an int64 representing a number of bytes to a
// human readable string representing the same number.
// e.g. 12345678 -> "11.77MiB".