且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

更换" =="有位运算符

更新时间:2022-10-23 18:43:30

两个数是相等的,如果他们之间没有什么区别:

  INT等于(INT X,int y)对{
   返回(X-Y)!;
}

Using only bitwise operators (|, &, ~, ^, >>, <<) and other basic operators like +, -, and !, is it possible to replace the "==" below?

int equal(int x, int y) {
    return x == y;
}

Two numbers are equal if there is no difference between them:

int equal(int x, int y){
   return !(x-y);
}