Skip to content

proquints in C

Inspired by https://github.com/dsw/proquint and https://wiki.xxiivv.com/site/proquints.html, a little snippet to generate a proquint from a 16-bit unsigned short.

const char* consonants = "bdfghjklmnprstvz";
const char* vowels = "aiou";

void proquint(uint16_t v, char* result) {
   /* c1 */ *(result++) = consonants[(v & (15 << 12))>>12];
   /* v1 */ *(result++) = vowels[(v & (3 << 10))>>10];
   /* c2 */ *(result++) = consonants[(v & (15 << 6))>>6];
   /* v2 */ *(result++) = vowels[(v & (3 << 4))>>4];
   /* c3 */ *(result) = consonants[(v & 15)];
}