Skip to content

Instantly share code, notes, and snippets.

@kmcallister
Created December 5, 2012 02:17
Show Gist options
  • Select an option

  • Save kmcallister/4211534 to your computer and use it in GitHub Desktop.

Select an option

Save kmcallister/4211534 to your computer and use it in GitHub Desktop.
impressive clang optimization
int is_json_space(char c) {
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
}
is_json_space:
cmpb $32, %dil
ja .LBB0_2
movzbl %dil, %ecx
movl $1, %eax
movabsq $4294977024, %rdx
btq %rcx, %rdx
jb .LBB0_3
.LBB0_2:
xorl %eax, %eax
.LBB0_3:
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment