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
/* | |
convert integer to ascii | |
see also: | |
https://johnnylee-sde.github.io/Fast-unsigned-integer-to-string/ | |
http://www.numberworld.org/y-cruncher/internals/radix-conversion.html | |
*/ | |
#include <stdio.h> | |
#include <stdint.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 <stddef.h> | |
#include <stdint.h> | |
/// flags | |
#define SVB_NORMAL 0 | |
#define SVB_SPECIALCASEZERO 1 | |
#define SVB_DELTAASCENDING 2 | |
#define SVB_DELTADESCENDING 4 | |
#define SVB_VARSIGNEXTEND 8 |
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 <stdint.h> | |
#include <immintrin.h> | |
// credit: YumiYumiYumi | |
// (fixed by aqrit) | |
__m128i _mm_tzcnt_epi32(__m128i v) { | |
__m128i mask = _mm_set1_epi32(0xffffff81); | |
v = _mm_and_si128(v, _mm_sign_epi32(v, mask)); | |
v = _mm_castps_si128(_mm_cvtepi32_ps(v)); |
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
/* | |
* various methods to strip whitespace from text | |
* (aka. despace, leftpack, copy_if) | |
* | |
* 'whitespace' is considered the following bytes: | |
* 0x09 - tab | |
* 0x20 - space | |
* 0x0A - line feed | |
* 0x0D - carriage return | |
*/ |
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
; Base64 decoder test using SSE2 instructions | |
; the program doesn't do '=' chars, bad chars, or bounds checks... | |
; | |
; License: WTFPL | |
; by: aqrit <bitpatch.com> in 2016 | |
; | |
; build instructions: | |
; yasm -f x64 -m AMD64 base64_decode_sse2_x64.asm | |
; Golink base64_decode_sse2_x64.obj kernel32.dll user32.dll | |
;;;;;;;;;;;;;;;; |