This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <template <typename, typename> class Base, typename Character> | |
static int __cdecl common_vfprintf( | |
unsigned __int64 const options, | |
FILE* const stream, | |
Character const* const format, | |
_locale_t const locale, | |
va_list const arglist | |
) throw() | |
{ | |
typedef output_processor< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; =============== S U B R O U T I N E ======================================= | |
; float __cdecl powf(float X, float Y) | |
public powf | |
powf proc near ; CODE XREF: cpowf+47p | |
; DATA XREF: _o_powf+3o ... | |
var_48 = xmmword ptr -48h | |
var_38 = xmmword ptr -38h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[diff] | |
tool = vsdiffmerge | |
guitool = vsdiffmerge | |
[difftool] | |
prompt = false | |
[difftool "vsdiffmerge"] | |
cmd = '"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsDiffMerge.exe"' "$LOCAL" "$REMOTE" //t | |
keepbackup = false | |
trustexistcode = true | |
[merge] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 384.0 in float: https://www.h-schmidt.net/FloatConverter/IEEE754.html | |
// Which was the bias value passed to a52_frame in C# code | |
constexpr int zeroLevel = 0x43c00000; | |
#ifdef _MSC_VER | |
using int16x8_t = __m128i; | |
using int32x4_t = __m128i; | |
__forceinline int32x4_t load4( const float* src ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Count newlines, 32 characters at a time | |
__forceinline void countNewlines( __m256i ascii, __m256i& counters ) | |
{ | |
// Find '\n' characters, 32 bytes at a time | |
__m256i newlines = _mm256_cmpeq_epi8( ascii, _mm256_set1_epi8( '\n' ) ); | |
// Convert 0xFF to 1 | |
newlines = _mm256_and_si256( newlines, _mm256_set1_epi8( 1 ) ); | |
// Accumulate the counters. | |
// The key part is _mm256_sad_epu8 instruction, here’s copy-paste from the docs: | |
// Compute the absolute differences of packed unsigned 8-bit integers in "a" and "b", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
namespace NativeSpan | |
{ | |
/// <summary>Allows manual memory management without GC in a manner that's still mostly safe</summary> | |
ref struct NativeSpan<T> where T : unmanaged | |
{ | |
readonly IntPtr nativePointer; | |
readonly int length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
/// <summary>Readonly stream of bytes</summary> | |
interface iReadStream | |
{ | |
/// <summary>Read bytes from the stream.</summary> | |
/// <remarks>Blocks indefinitely until the entire buffer is filled, throws exceptions when things fail.</remarks> | |
void read( Span<byte> buffer ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Numerics; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Runtime.Intrinsics; | |
using System.Runtime.Intrinsics.X86; | |
namespace SimdTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.IO.MemoryMappedFiles; | |
using System.Runtime.InteropServices; | |
namespace MemoryMapBug | |
{ | |
[StructLayout( LayoutKind.Sequential, Pack = 1 )] | |
struct sTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <emmintrin.h> | |
#include <tmmintrin.h> | |
__m128i cmpgt_epu64_ssse3( __m128i a, __m128i b ) | |
{ | |
// Compare uint32_t lanes for a > b and a < b | |
const __m128i signBits = _mm_set1_epi32( 0x80000000 ); | |
a = _mm_xor_si128( a, signBits ); | |
b = _mm_xor_si128( b, signBits ); | |
__m128i gt = _mm_cmpgt_epi32( a, b ); |