MCPcopy Create free account
hub / github.com/comaps/comaps / get_alphabet_position

Function get_alphabet_position

3party/open-location-code/openlocationcode.cc:74–80  ·  view source on GitHub ↗

Returns the position of a char in the encoding alphabet, or -1 if invalid.

Source from the content-addressed store, hash-verified

72
73// Returns the position of a char in the encoding alphabet, or -1 if invalid.
74int get_alphabet_position(char c) {
75 // We use a lookup table for performance reasons (e.g. over std::find).
76 if (c >= 'C' && c <= 'X') return internal::kPositionLUT[c - 'C'];
77 if (c >= 'c' && c <= 'x') return internal::kPositionLUT[c - 'c'];
78 if (c >= '2' && c <= '9') return c - '2';
79 return -1;
80}
81
82// Normalize a longitude into the range -180 to 180, not including 180.
83double normalize_longitude(double longitude_degrees) {

Callers 3

DecodeFunction · 0.85
IsValidFunction · 0.85
IsFullFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected