Sha256: f26b1758baf837942d13a9cd7894f84692ca2fa37beeb6dda9f031c502e56b48

Contents?: true

Size: 702 Bytes

Versions: 6

Compression:

Stored size: 702 Bytes

Contents

#include "arraytoc.h"
#include <stdio.h>

/** \brief make map of a byte to a string of 8 chars
 *
 *
 */
static void binary_encodemap(void)
{
    static const uint8_t sBinaryChars[] = "01";
    int i, j;
    uint8_t buf[9];

    printf("%s", "static const char* modp_b2_encodemap[] = {\n");
    buf[8] = 0;
    for (i = 0; i < 256; ++i) {
        for (j = 0; j < 8; ++j) {
            buf[j] = sBinaryChars[(i >> (7 - j)) & 1];
        }
        printf("\"%s\"", buf);
        if (i != 255) {
            printf("%s", ", ");
        }
        if ((i + 1) % 6 == 0) {
            printf("%s", "\n");
        }
    }
    printf("%s", "};\n");
}

int main(void)
{
    binary_encodemap();

    return 0;
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffi-hydrogen-0.1.5 vendor/stringencoders/src/modp_b2_gen.c
ffi-hydrogen-0.1.4 vendor/stringencoders/src/modp_b2_gen.c
ffi-hydrogen-0.1.3 vendor/stringencoders/src/modp_b2_gen.c
ffi-hydrogen-0.1.2 vendor/stringencoders/src/modp_b2_gen.c
ffi-hydrogen-0.1.1 vendor/stringencoders/src/modp_b2_gen.c
ffi-hydrogen-0.1.0 vendor/stringencoders/src/modp_b2_gen.c