In our last the case (1 + 1 = 10), how can we use binary operators with 1 and 1 to get 10 and make it work with bigger numbers? I smoked too much weed and cannot post a solution at the time.
>>10
Consult Google for explanations on how to use Google effectively.
Also, who the fuck cares if you got ``retarded java shit''? Jaev's bitwise operators are exactly the same as C's.
>>14
Perhaps, Austin Powers: smooth operator. >>16
It should be printing a ETX char for "1" ^ "2", not sure why you are getting a ". I'm pretty sure it performs the operator the ascii values, i.e.
$ php -r 'echo "yO-ZZV"^"V?_5=y","\n";'
/prog/
Name:
Anonymous2010-06-09 11:52
// here's my crude first attempt.
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
typedef uint8_t U;
U plus(U a, U b) {
U m = 1, am, bm, c=0, s, r=0;
while(m) {
am = !!(a & m);
bm = !!(b & m);
s = (am ^ bm);
if(c) {
if(!s) {
r |= m;
c = am & bm;
}
} else {
if(s)
r |= m;
c = am & bm;
}
printf("m:%16lu am:%lu bm:%lu c:%lu s:%lu r:%lu\n",m,am,bm,c,s,r);
m <<= 1;
}
return r;
}
int main(int argc, char **argv) {
U a=0,b=0;
if(argv[1]) {
a = atoi(argv[1]);
if(argv[2]) {
b = atoi(argv[2]);
}
}
printf("%lu + %lu: %lu\n",a,b,plus(a,b));
return 0;
}