MCPcopy Create free account
hub / github.com/apache/impala / FastUInt128ToBufferLeft

Function FastUInt128ToBufferLeft

be/src/gutil/strings/numbers.cc:1074–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072}
1073
1074char* FastUInt128ToBufferLeft(unsigned __int128 i, char* buffer) {
1075 static const unsigned __int128 TWENTY_DIGITS =
1076 static_cast<unsigned __int128>(10000000000)
1077 * static_cast<unsigned __int128>(10000000000);
1078
1079 uint64 u = static_cast<uint64>(i);
1080 if (u == i) return FastUInt64ToBufferLeft(u, buffer);
1081
1082 unsigned __int128 top_19_digits = i / TWENTY_DIGITS;
1083 buffer = FastUInt64ToBufferLeft(top_19_digits, buffer);
1084 unsigned __int128 rem128 = i - (top_19_digits * TWENTY_DIGITS);
1085
1086 unsigned __int128 middle_19_digits = rem128 / 10;
1087 buffer = FastUInt64ToBufferLeft(middle_19_digits, buffer);
1088 u = rem128 - (middle_19_digits * 10);
1089
1090 buffer = FastUInt32ToBufferLeft(u, buffer);
1091
1092 return buffer;
1093}
1094
1095char* FastInt128ToBufferLeft(__int128 i, char* buffer) {
1096 unsigned __int128 u = i;

Callers 2

FastInt128ToBufferLeftFunction · 0.85
SimpleItoaFunction · 0.85

Calls 2

FastUInt64ToBufferLeftFunction · 0.85
FastUInt32ToBufferLeftFunction · 0.85

Tested by

no test coverage detected