Sha256: b584b6757b1dfb3c44f7763b3d758c0a9156aeee8fa7182a3b1f23890b765b81
Contents?: true
Size: 297 Bytes
Versions: 396
Compression:
Stored size: 297 Bytes
Contents
#include "trinary.h" namespace trinary { int to_decimal(std::string const &text) { int result = 0; for (const char digit : text) { if (digit < '0' || digit > '2') { return 0; } result *= 3; result += digit - '0'; } return result; } }
Version data entries
396 entries across 396 versions & 1 rubygems