Skip to content

Instantly share code, notes, and snippets.

@tomtor
Last active October 13, 2017 11:18
Show Gist options
  • Save tomtor/a66edfeebaa8bad430bca515ea26f63e to your computer and use it in GitHub Desktop.
Save tomtor/a66edfeebaa8bad430bca515ea26f63e to your computer and use it in GitHub Desktop.
Esp32 ULP macro function
/* r0 = r0 xor r2, spills r1 */
.macro xor
/*
See https://stackoverflow.com/a/5377173
int bitwise_XOR(int a, int b)
{
return (a + b) - (a & b) - (a & b);
}
*/
and r1,r0,r2
add r0,r0,r2
sub r0,r0,r1
sub r0,r0,r1
.endm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment