Skip to main content
1 of 2
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

C and other languages with integer division, 15.204 14.644 14.084

unsigned char toUpper(unsigned char c){
    return c - ((c/97) & (1 - c/123)) << 5;
}

unsigned char toLower(unsigned char c){
    return c + ((c/65) & (1 - c/91)) << 5;
}
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975