Skip to content

Instantly share code, notes, and snippets.

@Siss3l
Created July 28, 2023 23:48
Show Gist options
  • Save Siss3l/a8684d94aea571d38d82e00e27cb4467 to your computer and use it in GitHub Desktop.
Save Siss3l/a8684d94aea571d38d82e00e27cb4467 to your computer and use it in GitHub Desktop.
Converting nucleotide ASCII characters to integers
#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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment