<commit_before>﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Diagnostics;

namespace Microsoft.Framework.WebEncoders
{
    internal struct AllowedCharsBitmap
    {
        private const int ALLOWED_CHARS_BITMAP_LENGTH = 0x10000 / (8 * sizeof(uint));
        private uint[] _allowedCharsBitmap;

        public AllowedCharsBitmap()
        {
            _allowedCharsBitmap = new uint[ALLOWED_CHARS_BITMAP_LENGTH];
        }

        // Marks a character as allowed (can be returned unencoded)
        public void AllowCharacter(char c)
        {
            uint codePoint = (uint)c;
            int index = (int)(codePoint >> 5);
            int offset = (int)(codePoint & 0x1FU);
            _allowedCharsBitmap[index] |= 0x1U << offset;
        }

        // Marks all characters as forbidden (must be returned encoded)
        public void Clear()
        {
            Array.Clear(_allowedCharsBitmap, 0, _allowedCharsBitmap.Length);
        }

        // Creates a deep copy of this bitmap
        public AllowedCharsBitmap Clone()
        {
            AllowedCharsBitmap retVal;
            retVal._allowedCharsBitmap = (uint[])this._allowedCharsBitmap.Clone();
            return retVal;
        }

        // Marks a character as forbidden (must be returned encoded)
        public void ForbidCharacter(char c)
        {
            uint codePoint = (uint)c;
            int index = (int)(codePoint >> 5);
            int offset = (int)(codePoint & 0x1FU);
            _allowedCharsBitmap[index] &= ~(0x1U << offset);
        }
        
        public void ForbidUndefinedCharacters()<commit_msg>Temporarily update struct => class.<commit_after>﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Diagnostics;

namespace Microsoft.Framework.WebEncoders
{
    internal class AllowedCharsBitmap
    {
        private const int ALLOWED_CHARS_BITMAP_LENGTH = 0x10000 / (8 * sizeof(uint));
        private uint[] _allowedCharsBitmap;

        public AllowedCharsBitmap()
        {
            _allowedCharsBitmap = new uint[ALLOWED_CHARS_BITMAP_LENGTH];
        }

        // Marks a character as allowed (can be returned unencoded)
        public void AllowCharacter(char c)
        {
            uint codePoint = (uint)c;
            int index = (int)(codePoint >> 5);
            int offset = (int)(codePoint & 0x1FU);
            _allowedCharsBitmap[index] |= 0x1U << offset;
        }

        // Marks all characters as forbidden (must be returned encoded)
        public void Clear()
        {
            Array.Clear(_allowedCharsBitmap, 0, _allowedCharsBitmap.Length);
        }

        // Creates a deep copy of this bitmap
        public AllowedCharsBitmap Clone()
        {
            var retVal = new AllowedCharsBitmap();
            retVal._allowedCharsBitmap = (uint[])this._allowedCharsBitmap.Clone();
            return retVal;
        }

        // Marks a character as forbidden (must be returned encoded)
        public void ForbidCharacter(char c)
        {
            uint codePoint = (uint)c;
            int index = (int)(codePoint >> 5);
            int offset = (int)(codePoint & 0x1FU);
            _allowedCharsBitmap[index] &= ~(0x1U << offset);
        }
        
        public void ForbidUndefinedCharacters()
{'fraction_non_alphanumeric': 0.08610567514677103, 'fraction_numerical': 0.01118255521386637, 'mean_word_length': 2.191793041926851, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '2139500', 'n_tokens_mistral': 994, 'n_tokens_neox': 923, 'n_words': 280}