issues
search
hegongshan
/
hegongshan.github.io
Personal blog
https://www.hegongshan.com
1
stars
0
forks
source link
关于CSAPP中Datalab模块conditional的题解
#10
Open
zhou-fuyi
opened
1 year ago
zhou-fuyi
commented
1 year ago
/*
conditional - same as x ? y : z
Example: conditional(2,4,5) = 4
Legal ops: ! ~ & ^ | + << >>
Max ops: 16
Rating: 3 */ int conditional(int x, int y, int z) { int flag = !x + ~0; return (flag & y) | (~flag & y); } 这里是写错了吧,应该是: return (flag & y) | (~flag & y); --> return (flag & y) | (~flag & z);
/*