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

Version Path
trackler-2.0.0.5 tracks/cpp/trinary/example.cpp
trackler-2.0.0.4 tracks/cpp/trinary/example.cpp
trackler-2.0.0.3 tracks/cpp/trinary/example.cpp
trackler-2.0.0.2 tracks/cpp/trinary/example.cpp
trackler-2.0.0.1 tracks/cpp/trinary/example.cpp
trackler-2.0.0.0 tracks/cpp/trinary/example.cpp
trackler-1.0.4.1 tracks/cpp/trinary/example.cpp
trackler-1.0.4.0 tracks/cpp/trinary/example.cpp
trackler-1.0.3.0 tracks/cpp/trinary/example.cpp
trackler-1.0.2.1 tracks/cpp/trinary/example.cpp
trackler-1.0.2.0 tracks/cpp/trinary/example.cpp
trackler-1.0.1.2 tracks/cpp/trinary/example.cpp
trackler-1.0.1.1 tracks/cpp/trinary/example.cpp
trackler-1.0.1.0 tracks/cpp/trinary/example.cpp
trackler-1.0.0.1 tracks/cpp/trinary/example.cpp
trackler-1.0.0 tracks/cpp/trinary/example.cpp