日期:2014-05-17 浏览次数:20441 次
function foo($a, $b, $c) {
$f1 = -(($c - $a) >> 31);
$f2 = -(($b - $c) >> 31);
$f3 = 1 ^ ($f1 + $f2);
return $f1 * max($a, $c) + $f2 * min($b, $c) + $f3 * $c;
}
echo foo(5, 10, 3); //5
echo foo(5, 10, 8); //8
echo foo(5, 10, 13); //10
function foo($a, $b, $c) {
Return (((($c-$a) + (($c-$a) >> 31)) ^ (($c-$a) >> 31)) - ((($c-$b) + (($c-$b) >> 31)) ^ (($c-$b) >> 31)) + $a + $b) / 2;
}
echo foo(20, 30, 50); // 30
#include<stdio.h>
int middle(int a,int b,int c)
{
long long la=a;
long long lb=b;
long long lc=c;