Created
July 28, 2023 23:48
-
-
Save Siss3l/a8684d94aea571d38d82e00e27cb4467 to your computer and use it in GitHub Desktop.
Converting nucleotide ASCII characters to integers
This file contains hidden or 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> | |
#include <stdint.h> | |
#include <immintrin.h> | |
int main() { // Working often on https://www.onlinegdb.com | gcc -O3 -mgfni -msse2 m128.c -o m128 && ./m128 | |
const __m128i r = _mm_gf2p8affine_epi64_epi8(_mm_set1_epi64(*(__m64*)"AaCcGgTt"),_mm_set1_epi64((__m64)433471464134410240),0); | |
for (int k=0;k<8;k++) {printf("(%c: %i)","AaCcGgTt"[k],((/*int*/uint8_t*)&r)[k]);} // (A: 0)(a: 0)(C: 1)(c: 1)(G: 2)(g: 2)(T: 3)(t: 3) | |
return 0; // https://stackoverflow.com/q/28939652 | Illegal instruction (core dumped) | _mm512_load_epi64 | |
} |
Comments are disabled for this gist.