<commit_before>module PP::MIME::Base64 {
    our Str constant @mapping =
        flat 'A' .. 'Z', 'a' .. 'z', '0' .. '9', '+', '/';

    # think about making this an our constant too some day
    my %reverse_mapping = (^64).map: { ; @mapping[ $_ ] => $_ };

    our Str sub encode_base64(Buf $b, Str $eol = "\n") is export {
        my Str $rc = '';
        my Str $padding_suffix = '';

        my $line_break_counter = 0;
        for $b.list -> $byte1, $byte2?, $byte3? {
            $rc ~= @mapping[ $byte1 +& 0b11111100 +> 2 ];
            if $byte2.defined {
                $rc ~= @mapping[
                        $byte1 +&  0b00000011 +< 4 +
                        $byte2 +&  0b11110000 +> 4
                ];
                if $byte3.defined {
                    $rc ~= @mapping[<commit_msg>add a comment about future implementations<commit_after>module PP::MIME::Base64 {
    our Str constant @mapping =
        flat 'A' .. 'Z', 'a' .. 'z', '0' .. '9', '+', '/';

    # think about making this an our constant too some day
    my %reverse_mapping = (^64).map: { ; @mapping[ $_ ] => $_ };

    # rfc 4648 gives http://josefsson.org/base-encoding/ as almost
    # but not quite a reference implementation.  I don't follow
    # that implementation here but note it for anyone considering
    # a parrot or external library implementation

    our Str sub encode_base64(Buf $b, Str $eol = "\n") is export {
        my Str $rc = '';
        my Str $padding_suffix = '';

        my $line_break_counter = 0;
        for $b.list -> $byte1, $byte2?, $byte3? {
            $rc ~= @mapping[ $byte1 +& 0b11111100 +> 2 ];
            if $byte2.defined {
                $rc ~= @mapping[
                        $byte1 +&  0b00000011 +< 4 +
                        $byte2 +&  0b11110000 +> 4
                ];
                if $byte3.defined {
                    $rc ~= @mapping[
{'fraction_non_alphanumeric': 0.14907161803713528, 'fraction_numerical': 0.0519893899204244, 'mean_word_length': 1.6600846262341327, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4082975', 'n_tokens_mistral': 655, 'n_tokens_neox': 581, 'n_words': 174}