Skip to content

Instantly share code, notes, and snippets.

View tannergooding's full-sized avatar

Tanner Gooding tannergooding

View GitHub Profile
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using TerraFX.Interop;
using TerraFX.Interop.Windows;
using static TerraFX.Interop.Windows.E;
using static TerraFX.Interop.Windows.IID;
using static TerraFX.Interop.Windows.S;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public unsafe class Proga
{
static void Main(string[] args)
@tannergooding
tannergooding / After.cs
Created October 1, 2021 01:59
Comparison of before xplat hwintrinsics and after
public float Sum(float[] values) {
if (values is null)
{
throw new ArgumentNullException();
}
if (Vector128.IsHardwareAccelerated)
{
ref var value = ref MemoryMarshal.GetArrayDataReference(values);
var vsum = Vector128<float>.Zero;
#include "lib.h"
#include "common.h"
#include <iostream>
void thing()
{
auto lib_id1 = get_next_lib_id_int32();
auto lib_id2 = get_next_lib_id_size();
using System;
using System.Threading;
using System.Threading.Tasks;
class Program
{
const int limit = 100_000_000;
static void Main(string[] args)
{
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using TerraFX.CodeAnalysis.Source;
//------------------------------------------------------------------------
// gtFoldExprCast: see if a cast is foldable
//
// Arguments:
// cast - cast to examine
//
// Returns:
// The original cast if no folding happened.
// An alternative tree if folding happens.
//
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
public unsafe class NetStandardPlus
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void MyStdcallDelegate();
public static void Call(delegate*<void> action) => action();
using System;
using System.Runtime.CompilerServices;
public interface IComparer<T>
{
int CompareTo(T other);
}
public static class ArrayExtensions
{
// This is a port of the amd/win-libm implementation provided in assembly here: https://github.com/amd/win-libm/blob/master/sinf.asm
// The original source is Copyright (c) 2002-2019 Advanced Micro Devices, Inc. and provided under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this Software and associated documentaon files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//