{{ message }}

Instantly share code, notes, and snippets.

# KonstantinConst-me

Last active Mar 19, 2016
View Capstone.DisasmEx.cs
 using Gee.External.Capstone; using Gee.External.Capstone.X86; using System; using System.Collections.Generic; using System.Linq; namespace InstructionsCheck { /// This class implements a way to disassemble real-life modules with Capstone. /// Real-life x86 and amd64 code contains inline data.
Created Jul 25, 2016
A benchmark comparing three methods of sine + cosine computation: stdlib, DirectX which is 10-11 degree polynomial approximation, and linearly-interpolated lookup table.
View SinCosMicrobench.cpp
 #include "stdafx.h" using std::vector; typedef std::chrono::high_resolution_clock stopwatch; using namespace DirectX; using std::array; struct StdLib { inline void sinCos( float val, float& s, float& c ) const
Last active Nov 12, 2016
View ffx.cpp
 #include "stdafx.h" int f( int x ) { if( 0 == x ) return 0; if( 0x80000000 == x ) return 0x80000001; const int c = ( ( x >> 31 ) & 1 ) * -2 + 1; const int mul = ( x & 1 ) * 2 - 1;
Last active Sep 27, 2017
View set-count.cpp
 #include #include using stopwatch = std::chrono::high_resolution_clock; static const size_t count = 4 * 1024 * 1024; void setup( std::unordered_set& set ) { srand( 0 ); for( size_t i = 0; i < count; i++ )
Last active Apr 7, 2018
View SinCosAngle.cpp
 #define _USE_MATH_DEFINES #include struct Point { double x, y; }; // A class that contains a 2D angle as a pair of sine + cosine values. // Sometimes, this approach saves substantial CPU time that would be wasted running these trigonometry functions.
Created Feb 16, 2018
View shared-ptr-example.cpp
 #include #include #include #include #include // Can be hundreds of megabytes in these vectors class Mesh { std::string name;
Created Apr 23, 2018
View FixEncoding.cs
 // (c) 2018 const.me // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 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: // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. // The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. // In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or
Created May 25, 2018
View SyncTest.cs