Skip to main content
Fixed the explanation: *_/32 without masking would always be true. Nice idea using + instead of ^.
Source Link
Peter Cordes
  • 5.1k
  • 1
  • 24
  • 35

C (gcc), 41 36 bytes

f(char*_){_=!_[1]||*_/32+*++_&f(_);} 

Try it online!

-5 eliminated &1 starting off from an idea from Peter Cordes; changed operators (precedence) to remove parentheses


Uses ~. Checks the first and sixth bits of the first two characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

(*_ / 32) & 1 is true only for chars that end high, while *_ & 1 is true only for chars that start low. (x&1) ^ (y&1) == (x+y)&1. XOR is add-without-carry, and carry doesn't disturb the lowest bit. The 1 comes from the f(_) return value, if the rest of the string was stringy.

C (gcc), 41 36 bytes

f(char*_){_=!_[1]||*_/32+*++_&f(_);} 

Try it online!

-5 eliminated &1 starting off from an idea from Peter Cordes; changed operators (precedence) to remove parentheses


Uses ~. Checks the first and sixth bits of the first two characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

*_ / 32 is true only for chars that end high, while *_ & 1 is true only for chars that start low.

C (gcc), 41 36 bytes

f(char*_){_=!_[1]||*_/32+*++_&f(_);} 

Try it online!

-5 eliminated &1 starting off from an idea from Peter Cordes; changed operators (precedence) to remove parentheses


Uses ~. Checks the first and sixth bits of the first two characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

(*_ / 32) & 1 is true only for chars that end high, while *_ & 1 is true only for chars that start low. (x&1) ^ (y&1) == (x+y)&1. XOR is add-without-carry, and carry doesn't disturb the lowest bit. The 1 comes from the f(_) return value, if the rest of the string was stringy.

added 244 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

C (gcc), 4141 36 bytes

f(char*_){_=!_[1]||*_>>5&1^*++_&1&&f_[1]||*_/32+*++_&f(_);} 

Try it online!Try it online!

-5 eliminated &1 starting off from an idea from Peter Cordes; changed operators (precedence) to remove parentheses

 

Uses ~. Checks the first and sixth bits of the first two characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

*_ &/ 32 is true only for chars that end high, while *_ & 1 is true only for chars that start low.

C (gcc), 41 bytes

f(char*_){_=!_[1]||*_>>5&1^*++_&1&&f(_);} 

Try it online!

Uses ~. Checks the first and sixth bits of the characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

*_ & 32 is true for chars that end high, while *_ & 1 is true only for chars that start low.

C (gcc), 41 36 bytes

f(char*_){_=!_[1]||*_/32+*++_&f(_);} 

Try it online!

-5 eliminated &1 starting off from an idea from Peter Cordes; changed operators (precedence) to remove parentheses

 

Uses ~. Checks the first and sixth bits of the first two characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

*_ / 32 is true only for chars that end high, while *_ & 1 is true only for chars that start low.

correct the ordinal number of the bit positions, and highlight them in the diagram
Source Link
Peter Cordes
  • 5.1k
  • 1
  • 24
  • 35

C (gcc), 41 bytes

f(char*_){_=!_[1]||*_>>5&1^*++_&1&&f(_);} 

Try it online!

Uses ~. Checks the first and fifthsixth bits of the characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

*_ & 32 is true for chars that end high, while *_ & 1 is true only for chars that start low.

C (gcc), 41 bytes

f(char*_){_=!_[1]||*_>>5&1^*++_&1&&f(_);} 

Try it online!

Uses ~. Checks the first and fifth bits of the characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 

and traverses the string recursively.

C (gcc), 41 bytes

f(char*_){_=!_[1]||*_>>5&1^*++_&1&&f(_);} 

Try it online!

Uses ~. Checks the first and sixth bits of the characters' binary representations:

_ 1011111 \ 1011100 / 101111 ~ 1111110 ^ ^ 

and traverses the string recursively.

*_ & 32 is true for chars that end high, while *_ & 1 is true only for chars that start low.

added 109 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70
Loading
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70
Loading