<commit_before>﻿using System;

namespace Libraries.ByteArray
{
    public partial class ByteArray
    {
        /// <summary>
        /// Write an ASCII char without advancing the internal position
        /// </summary>
        /// <param name="value"></param>
        /// <param name="position">ByteArray index to write to</param>
        /// <returns></returns>
        public void WriteCharA(char value, int position)
        {
            this.buffer[position] = Convert.ToByte(value);
        }
        /// <summary>
        /// Write an UNICODE char without advancing the internal position
        /// </summary>
        /// <param name="value"></param>
        /// <param name="position">ByteArray index to write to</param>
        /// <returns></returns>
        public void WriteCharW(char value, int position)
        {
            ushort tmp = Convert.ToUInt16(value);
            this.buffer[position + 0] = (byte)tmp;
            this.buffer[position + 1] = (byte)(tmp >> 8);
        }

        /// <summary>
        /// Write an ASCII char advancing the internal position<commit_msg>Add guard for writing wide strings with the ascii function<commit_after>﻿using System;

namespace Libraries.ByteArray
{
    public partial class ByteArray
    {
        /// <summary>
        /// Write an ASCII char without advancing the internal position
        /// </summary>
        /// <param name="value"></param>
        /// <param name="position">ByteArray index to write to</param>
        /// <returns></returns>
        public void WriteCharA(char value, int position)
        {
            if (value > 255)
            {
                this.buffer[position] = 63;
            }
            else
            {
                this.buffer[position] = Convert.ToByte(value);
            }
        }
        /// <summary>
        /// Write an UNICODE char without advancing the internal position
        /// </summary>
        /// <param name="value"></param>
        /// <param name="position">ByteArray index to write to</param>
        /// <returns></returns>
        public void WriteCharW(char value, int position)
        {
            ushort tmp = Convert.ToUInt16(value);
            this.buffer[position + 0] = (byte)tmp;
            this.buffer[position + 1] = (byte)(tmp >> 8);
        }

        /// <summary>
        /// Write an ASCII char advancing the internal position
{'fraction_non_alphanumeric': 0.12797992471769135, 'fraction_numerical': 0.006273525721455458, 'mean_word_length': 1.727480045610034, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 42, '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': '1452359', 'n_tokens_mistral': 635, 'n_tokens_neox': 598, 'n_words': 176}