Skip to content

Instantly share code, notes, and snippets.

View akeit0's full-sized avatar

Akito Inoue akeit0

  • Tokyo
  • 00:52 (UTC +09:00)
View GitHub Profile
@akeit0
akeit0 / FixedTypeKeyHashtable.cs
Last active December 20, 2025 14:04
Minimal memory FixedTypeKeyHashtable
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
// ReSharper disable LocalVariableHidesMember
//modified from http://neue.cc/2017/07/11_555.html
sealed class FixedTypeKeyHashtable<TValue>
{
@akeit0
akeit0 / AddOnlyThreadSafeSeparateChainingDictionary.cs
Created December 19, 2025 11:14
AddOnlyThreadSafeSeparateChainingDictionary in C#
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@akeit0
akeit0 / DefaultInterpolatedStringHandler.cs
Last active November 17, 2025 14:43
DefaultInterpolatedStringHandler for Unity
#define FILLATTRIBUTES // Uncomment this line to fill the attributes
//#define INTERNAL // Uncomment this line to make the class internal
#define TMP_INTERPOTATION_EXTENSIONS // Uncomment this line to add TMP extensions
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable enable
using System.Buffers;
using System.Diagnostics;
@akeit0
akeit0 / Program.cs
Last active February 27, 2025 14:28
What IL can do for generics constraints.
using System.Numerics;
using System.Runtime.CompilerServices;
using InlineIL;
//Not IDisposable
TestClass.DisposeTest(1);
//TestClass
Console.WriteLine(TestClass.Self(new TestClass()));
//Dispose
using System;
public class C {
public int M(int[,] array,int i,int j) {
return array[i,j];
}
public int M(int[][] array,int i,int j) {
return array[i][j];
}
using System;
public class Test
{
struct Struct()
{
public int A = 0;
}
public int IncrementSlow()
{
@akeit0
akeit0 / RomajiReader.cs
Last active August 15, 2024 00:22
RomajiReader Windowsの入力はおそらく全対応
//These codes are licensed under CC0.
using System;
using System.Collections.Generic;
//using RomajiReader;
// var reader = Reader.Default;
// Console.WriteLine(reader.Convert("shinkyoku"));//しゅんきょく
// Console.WriteLine(reader.Convert("kappa"));//かっぱ
// Console.WriteLine(reader.Convert("cinkya"));//しんきゃ
// Console.WriteLine(reader.Convert("rweqqap"));//rうぇっくぁp
// Console.WriteLine(reader.Convert("RWEQQAP"));//RうぇっくぁP
@akeit0
akeit0 / UnityConsoleRedirect.cs
Created August 10, 2024 08:30
ConsoleRedirect
//License
//These codes are licensed under CC0.
using System.IO;
using System.Text;
using UnityEngine;
static class ConsoleRedirect
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ConsoleInit()
@akeit0
akeit0 / DefaultInterpolatedStringHandler.cs
Last active November 1, 2025 10:05
DefaultInterpolatedStringHandler for .netstandard2.1
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable enable
using System.Buffers;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Runtime.CompilerServices
@akeit0
akeit0 / DefaultInterpolatedStringHandler.NonGeneric.cs
Last active August 10, 2024 05:12
DefaultInterpolatedStringHandler for .netstandard2.1
namespace System.Runtime.CompilerServices
{
public ref partial struct DefaultInterpolatedStringHandler
{
public void AppendFormatted(float value)=> AppendFormatted(value, null);
public void AppendFormatted(int value)=> AppendFormatted(value, null);
public void AppendFormatted(double value)=> AppendFormatted(value, null);