<commit_before>using System;

namespace NSec.Cryptography
{
    internal struct Oid
    {
        private readonly byte[] _bytes;

        public Oid(
            uint first,
            uint second,
            params uint[] rest)
        {
            int length = CalcLength(first * 40 + second);
            for (int i = 0; i < rest.Length; i++)
                length += CalcLength(rest[i]);
            byte[] bytes = new byte[length];
            int pos = Encode(first * 40 + second, bytes, 0);
            for (int i = 0; i < rest.Length; i++)
                pos += Encode(rest[i], bytes, pos);
            _bytes = bytes;
        }

        public ReadOnlySpan<byte> Bytes => _bytes ?? ReadOnlySpan<byte>.Empty;

        private static int CalcLength(
            uint value)
        {
            int length = 0;
            if ((value & 0xF0000000) != 0)
                throw new NotImplementedException();
            if ((value & 0xFFE00000) != 0)
                length++;
            if ((value & 0xFFFFC000) != 0)
                length++;
            if ((value & 0xFFFFFF80) != 0)
                length++;
            length++;
            return length;
        }

        private static int Encode(
            uint value,
            byte[] buffer,
            int pos)
        {
            int start = pos;
            if ((value & 0xF0000000) != 0)
                throw new NotImplementedException();
            if ((value & 0xFFE00000) != 0)
                buffer[pos++] = (byte)((value >> 21) & 0x7F | 0x80);
            if ((value & 0xFFFFC000) != 0)
                buffer[pos++] = (byte)((value >> 14) & 0x7F | 0x80);
            if ((value & 0xFFFFFF80) != 0)
                buffer[pos++] = (byte)((value >> 7) & 0x7F | 0x80);
            buffer[pos++] = (byte)(value & 0x7F);
            return pos - start;
        }
    }
}
<commit_msg>Use assert for internal API<commit_after>using System;
using System.Diagnostics;

namespace NSec.Cryptography
{
    internal struct Oid
    {
        private readonly byte[] _bytes;

        public Oid(
            uint first,
            uint second,
            params uint[] rest)
        {
            int length = CalcLength(first * 40 + second);
            for (int i = 0; i < rest.Length; i++)
                length += CalcLength(rest[i]);
            byte[] bytes = new byte[length];
            int pos = Encode(first * 40 + second, bytes, 0);
            for (int i = 0; i < rest.Length; i++)
                pos += Encode(rest[i], bytes, pos);
            _bytes = bytes;
        }

        public ReadOnlySpan<byte> Bytes => _bytes ?? ReadOnlySpan<byte>.Empty;

        private static int CalcLength(
            uint value)
        {
            int length = 0;
            Debug.Assert((value & 0xF0000000) == 0);
            if ((value & 0xFFE00000) != 0)
                length++;
            if ((value & 0xFFFFC000) != 0)
                length++;
            if ((value & 0xFFFFFF80) != 0)
                length++;
            length++;
            return length;
        }

        private static int Encode(
            uint value,
            byte[] buffer,
            int pos)
        {
            int start = pos;
            Debug.Assert((value & 0xF0000000) == 0);
            if ((value & 0xFFE00000) != 0)
                buffer[pos++] = (byte)((value >> 21) & 0x7F | 0x80);
            if ((value & 0xFFFFC000) != 0)
                buffer[pos++] = (byte)((value >> 14) & 0x7F | 0x80);
            if ((value & 0xFFFFFF80) != 0)
                buffer[pos++] = (byte)((value >> 7) & 0x7F | 0x80);
            buffer[pos++] = (byte)(value & 0x7F);
            return pos - start;
        }
    }
}

{'fraction_non_alphanumeric': 0.12837108953613807, 'fraction_numerical': 0.043149946062567425, 'mean_word_length': 1.3534263959390862, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '1515965', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1047, 'n_words': 298}