Discussion of chess software programming and technical issues.
Moderators: hgm , Rebel , chrisw
Dann Corbit
Posts: 12541 Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA
Post
by Dann Corbit » Fri Jan 23, 2015 11:42 pm
Code: Select all
#include <stdio.h>
int main(void)
{
printf("The answer is %x, or is it %x? Hmmm... Makes no sense. Maybe %x (if the Bard approve of mixing metaphors)?\n",
0x2b || !0x2b, 0x2b | ~0x2b, 0x2b | !0x2b);
return 0;
}
bob
Posts: 20943 Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL
Post
by bob » Fri Jan 23, 2015 11:55 pm
i'll byte here...
what is the point??
Perhaps that some don't understand the ! operator?
Dann Corbit
Posts: 12541 Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA
Post
by Dann Corbit » Sat Jan 24, 2015 12:08 am
It's just a lame Shakespeare joke that occurred to me when I was thinking about bit patterns.
"To be or not to be", as logical or bitwise operations results in 1 or -1, but mixing the operations as I chose results in 'to be.'
For some reason, it struck me funny.
Dann Corbit
Posts: 12541 Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA
Post
by Dann Corbit » Sat Jan 24, 2015 12:11 am
dcorbit@dcorbit /q
$ ./a.exe
The answer is 1, or is it ffffffff? Hmmm... Makes no sense. Maybe 2b (if the Bard approve of mixing metaphors)?
mar
Posts: 2559 Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak
Post
by mar » Sat Jan 24, 2015 12:34 am
got it. like it. but why the spoiler?
bob
Posts: 20943 Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL
Post
by bob » Sat Jan 24, 2015 12:35 am
mar wrote: got it. like it. but why the spoiler?
Because some of "us" don't think in terms of Shakespeare.
mvk
Posts: 589 Joined: Tue Jun 04, 2013 10:15 pm
Post
by mvk » Sat Jan 24, 2015 12:54 am
Dann Corbit wrote: Code: Select all
#include <stdio.h>
int main(void)
{
printf("The answer is %x, or is it %x? Hmmm... Makes no sense. Maybe %x (if the Bard approve of mixing metaphors)?\n",
0x2b || !0x2b, 0x2b | ~0x2b, 0x2b | !0x2b);
return 0;
}
In your case I wish 0x04 '0x2b'.
[Account deleted]
johnwbyrd
Posts: 9 Joined: Tue Jan 20, 2015 3:22 am
Post
by johnwbyrd » Thu Jan 29, 2015 8:46 pm
I think you've just come up with a fairly subtle DSP interview question. What do the following expressions evaluate to, and why?
0x2b || ~0x2b
0x2b || !0x2b
0x2b | ~0x2b
0x2b | !0x2b
(I added back in the missing combination)
johnwbyrd
Posts: 9 Joined: Tue Jan 20, 2015 3:22 am
Post
by johnwbyrd » Thu Jan 29, 2015 9:19 pm
2 * 0xb | ~2 * 0xb
2 * 0xb | !2 * 0xb
!?