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
#define WIN32_LEAN_AND_MEAN | |
#define NOMINMAX | |
#include <windows.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <array> | |
#include <algorithm> | |
void printStack( const char* what ) | |
{ |
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 "stdafx.h" | |
#include <EASTL/allocator.h> | |
namespace eastl | |
{ | |
// Implement assertion failure. This version just traps to debugger. | |
void __cdecl AssertionFailure( const char *af ) | |
{ | |
OutputDebugStringA( af ); | |
__debugbreak(); |
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 "stdafx.h" | |
#include <SimpleMath.h> | |
using DirectX::SimpleMath::Vector2; | |
#include <Mathematics/GteIntrSegment2Segment2.h> | |
inline gte::Vector2<float> _gte( const Vector2& dx ) | |
{ | |
return gte::Vector2<float>{ dx.x, dx.y }; | |
} |
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 <iostream> | |
#include <array> | |
#include <experimental/generator> | |
using namespace std::experimental; | |
using Triple = std::array<int, 3>; | |
// Generate infinite sequence of Pythagorean triples | |
generator<Triple> triples() | |
{ |
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 "stdafx.h" | |
// A quick test of small Eigen vector classes. Tested on visual Studio 15.9.2, release 64 bit. | |
#define EIGEN_VECTORIZE_SSE | |
#define EIGEN_VECTORIZE_SSE2 | |
#define EIGEN_VECTORIZE_SSE3 | |
#define EIGEN_VECTORIZE_SSE4_1 | |
#include "Eigen/Dense" | |
#include <d3d11.h> |
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 <stdio.h> | |
int main() | |
{ | |
// Invalid 2 octet sequence: https://stackoverflow.com/a/3886015/126995 | |
FILE* f = fopen( "/home/kosta/\xc3\x28", "w" ); | |
fclose( f ); | |
} |
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.Windows; | |
using System.Windows.Interop; | |
static class SubclassWindow | |
{ | |
// Call this from the constructor of your main window. SourceInitialized event is raised long after the constructor. | |
public static void initialize( Window wnd ) | |
{ | |
wnd.SourceInitialized += ( object sender, EventArgs e ) => sourceInitialized( wnd ); |
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
static class Utils | |
{ | |
/// <summary>Append a new item to list, return that item</summary> | |
public static E appendNew<E>( List<E> list ) where E : new() | |
{ | |
E newVal = new E(); | |
list.Add( newVal ); | |
return newVal; | |
} | |
} |
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
// Tested with .NET Core 2.2, will likely work with the rest of the runtimes | |
using System; | |
using System.Diagnostics; | |
using System.IO.MemoryMappedFiles; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
namespace MappedFileTest | |
{ | |
static class Program |
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.Runtime.Intrinsics; | |
using System.Runtime.Intrinsics.X86; | |
namespace SimdBrightness | |
{ | |
static class Program | |
{ | |
/// <summary>Load 4 pixels of RGB</summary> |