<commit_before>﻿using System;
using System.Runtime.InteropServices;

public static class Program {
    [StructLayout(LayoutKind.Explicit)]
    public struct Test {
        [FieldOffset(0)]
        public byte A;

        [FieldOffset(1)]
        public byte B;

        [FieldOffset(0)]
        public uint C;

        [FieldOffset(6)]
        public float D;

        public override string ToString () {
            return String.Format(
                "A={0:X2}, B={1:X2}, C={2:X8}, D={3:00.000}",
                A, B, C, D
            );
        }
    }

    public static unsafe void Main (string[] args) {
        var buffer = new byte[32];

        fixed (byte *pBuffer = buffer) {
            Array.Clear(buffer, 0, 32);
            *((Test*)pBuffer) = new Test { C = 0xFAEBDCCD, D = 3.3f };
            Util.PrintBytes(buffer);
            Console.WriteLine(*((Test*)pBuffer));
        }
    }
}<commit_msg>Custom padding using FieldOffset works<commit_after>﻿using System;
using System.Runtime.InteropServices;

public static class Program {
    [StructLayout(LayoutKind.Explicit)]
    public struct Padded {
        [FieldOffset(0)]
        public byte A;

        [FieldOffset(2)]
        public uint B;

        [FieldOffset(9)]
        public float C;

        public override string ToString () {
            return String.Format(
                "A={0:X2}, B={1:X8}, C={2:00.000}",
                A, B, C
            );
        }
    }

    public static unsafe void Main (string[] args) {
        var buffer = new byte[32];

        fixed (byte *pBuffer = buffer) {
            Array.Clear(buffer, 0, 32);
            *((Padded*)pBuffer) = new Padded { A = 0x1B, B = 0xFAEBDCCD, C = 3.3f };
            Util.PrintBytes(buffer);
            Console.WriteLine(*((Padded*)pBuffer));
        }
    }
}
{'fraction_non_alphanumeric': 0.1282333516785911, 'fraction_numerical': 0.025866813428728673, 'mean_word_length': 1.8098918083462132, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2546258', 'n_tokens_mistral': 578, 'n_tokens_neox': 540, 'n_words': 138}