summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_bytestring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/cfx_bytestring.cpp')
-rw-r--r--core/fxcrt/cfx_bytestring.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/cfx_bytestring.cpp
index 7a738277cf..efe49f8fd6 100644
--- a/core/fxcrt/cfx_bytestring.cpp
+++ b/core/fxcrt/cfx_bytestring.cpp
@@ -801,53 +801,6 @@ void CFX_ByteString::TrimLeft() {
TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
}
-FX_STRSIZE FX_ftoa(float d, char* buf) {
- buf[0] = '0';
- buf[1] = '\0';
- if (d == 0.0f) {
- return 1;
- }
- bool bNegative = false;
- if (d < 0) {
- bNegative = true;
- d = -d;
- }
- int scale = 1;
- int scaled = FXSYS_round(d);
- while (scaled < 100000) {
- if (scale == 1000000) {
- break;
- }
- scale *= 10;
- scaled = FXSYS_round(d * scale);
- }
- if (scaled == 0) {
- return 1;
- }
- char buf2[32];
- FX_STRSIZE buf_size = 0;
- if (bNegative) {
- buf[buf_size++] = '-';
- }
- int i = scaled / scale;
- FXSYS_itoa(i, buf2, 10);
- FX_STRSIZE len = FXSYS_strlen(buf2);
- memcpy(buf + buf_size, buf2, len);
- buf_size += len;
- int fraction = scaled % scale;
- if (fraction == 0) {
- return buf_size;
- }
- buf[buf_size++] = '.';
- scale /= 10;
- while (fraction) {
- buf[buf_size++] = '0' + fraction / scale;
- fraction %= scale;
- scale /= 10;
- }
- return buf_size;
-}
-
CFX_ByteString CFX_ByteString::FormatFloat(float d, int precision) {
char buf[32];
FX_STRSIZE len = FX_ftoa(d, buf);