Skip to content

Instantly share code, notes, and snippets.

View Emik03's full-sized avatar
🇺🇦
o pona lon ma Ukalawa! mi wile pona e pilin pi jan ale!

Emik Emik03

🇺🇦
o pona lon ma Ukalawa! mi wile pona e pilin pi jan ale!
View GitHub Profile
@Emik03
Emik03 / f32-benchmarks.md
Last active October 17, 2024 09:35
Function to convert the provided number into a single-precision floating point.

LuaJIT on an AMD Ryzen 5 3600 (12) @ 4.3GHz

Case Time
Best 0.06µs
Average 0.90µs
Worst 1.54µs

Best cases come from NaN, Infinity, and -Infinity.

@Emik03
Emik03 / Concurrent.cs
Last active May 20, 2024 15:59
Thread-safe version of List<T> for C#
// SPDX-License-Identifier: MPL-2.0
using System.Collections;
using System.Diagnostics;
using System.Threading;
namespace Emik;
/// <summary>
/// Provides <see cref="List{T}"/>; the thread-safe equivalent of <see cref="System.Collections.Generic.List{T}"/>.
/// </summary>
@Emik03
Emik03 / PadCenter.cs
Last active January 6, 2024 21:51
Joke implementation of padding that's neither from the left or right, but from the center of the string, accounting for unevenness of both the string's length and the passed in total width.
#region Emik.Unlicense
// <copyright file="PadCenter.cs" company="Emik">
// Copyright (c) Emik.
// 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.
@Emik03
Emik03 / op_Equality.NET.cs
Last active January 11, 2023 16:37
From Emik.Morsels, requires a reference to it and FodyHelpers on .NET 5.0+. https://github.com/Emik03/Emik.Morsels
#region Emik.Unlicense
// <copyright file="op_Equality.NET.cs" company="Emik">
// Copyright (c) Emik.
// 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.