Example #1
0
static int precompute_integers() {
  String::converted_integers_raw =
    (StringData *)malloc(NUM_CONVERTED_INTEGERS * sizeof(StringData));
  String::converted_integers = String::converted_integers_raw - SCHAR_MIN;
  for (int n = SCHAR_MIN; n < 65536; n++) {
    StringData *sd = String::converted_integers + n;
    convert_integer_helper(n, sd);
  }
  return NUM_CONVERTED_INTEGERS;
}
Example #2
0
const StringData *String::ConvertInteger(int64_t n) {
  StringData const **psd = converted_integers + n;
  const StringData *sd = convert_integer_helper(n);
  *psd = sd;
  return sd;
}
Example #3
0
void String::PreConvertInteger(int64_t n) {
  IntegerStringDataMap::const_iterator it =
    integer_string_data_map.find(n);
  if (it != integer_string_data_map.end()) return;
  integer_string_data_map[n] = convert_integer_helper(n);
}