value是byte类型,有8位,如:0110 1100,(value&0xf0)>>4的结果就是value变成:0000 0110,效果就是取出原来高四位,并移到低四位,再把高四位置0。而value&0x0f的作用就是把value值得高四位置0,低4位不变,结果就是0000 0110
(n << 1) ^ (n >> 31)n是int型,32位,n<<1表示左移一位,如原来:
1000 0000 0000 0000 1000 0000 0000 0001
移完之后:0000 0000 0000 0001 0000 0000 0000 0010
n>>31 带符号右移31位,如原来:1000 0000 0000 0000 1000 0000 0000 0001移完之后:
1111 1111 1111 1111 1111 1111 1111 1110,因为原来的数最高位是1,所以右移时,高位补1,而不是0
^表示异或,11得0,00得0,10得1,01得1,1000 0001^0011 1100得到:1011 1101
~表示取反,~0000 1111得到:1111 0000
剩下的,自己想把
(n << 1) ^ (n >> 31)n是int型,32位,n<<1表示左移一位,如原来:
1000 0000 0000 0000 1000 0000 0000 0001
移完之后:0000 0000 0000 0001 0000 0000 0000 0010
n>>31 带符号右移31位,如原来:1000 0000 0000 0000 1000 0000 0000 0001移完之后:
1111 1111 1111 1111 1111 1111 1111 1110,因为原来的数最高位是1,所以右移时,高位补1,而不是0
^表示异或,11得0,00得0,10得1,01得1,1000 0001^0011 1100得到:1011 1101
~表示取反,~0000 1111得到:1111 0000
剩下的,自己想把
int c= ((a & 0xf0)>>4) + (a & 0x0f); //得到的是1
int c= (a & 0xf0)>>4 + (a & 0x0f);//得到的是0这是什么情况?什么原理导致的?
你最好先看看操作符的优先级, +号的优先级在移位操作之前,也就是说,你下面那句为0 是相当于移动了5位
也就是
int c= (a & 0xf0)>>4 + (a & 0x0f);//得到的是0
这句相当于
int c= (a & 0xf0)>>(4 + (a & 0x0f));//得到的是0
temp varchar2(32);
transactionId varchar2(36);
numberTemp varchar2(21);
orderId varchar2(36);
i number;
begin
-------------------------------
---
-------------------------------
i:=1;
for numbers in 120202..220201
loop
numberTemp := numbers;
while lengthb(numberTemp) < 8
loop
numberTemp :='0'||numberTemp;
end loop;
numberTemp :='133'||numberTemp;
--------------------------
select SYS_GUID() into temp from dual;
transactionId := SUBSTR(temp,1,8)||'-' || substr(temp,9,4)||'-'||substr(temp,13,4)||'-'||substr(temp,17,4)||'-'||substr(temp,21,12);
--------------------------------------------------------
select SYS_GUID() into temp from dual;
orderId := SUBSTR(temp,1,8)||'-' || substr(temp,9,4)||'-'||substr(temp,13,4)||'-'||substr(temp,17,4)||'-'||substr(temp,21,12);
----------------------------------------------------------------------------------
insert into T_XXTABLE (transactionId,appkey, apiConsumerId, userId, fee, accesschannel, currencyCode
,orderId,productName,productDesc,amount,iapId,createTime,chargeTime,finishTime,status)
values (transactionId,'1e56ca98e0534a41bb6c170d0e304ba8', '17e9d673-21ac-4c0e-a81a-f987bb211101', '8613912345678', 100, 2, 'USD',orderId
,'sdjaldsa','adsafdsa',1,'sfasd','20140107200558','','',1);
if i = 100000
then
commit;
i := 1;
else
i := i+1;
end if;
end loop;
commit;
end;
/