J jh_pan Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-13 #1 请问各位: 如何将一个32位实数(real)的前16位和后16位分别存入两个16位的smallint中?
P Pipi. Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-13 #2 如果你是要r实际存储值 r:real; i1,i2:smallint; r:=1.1; i1:=smallint(((PLongWord(@r))^)shr 16); i2:=smallint(((PLongWord(@r))^) and $ffff); 如果你是要把real换成32bit整数值 r:real; i1,i2:smallint; lw:longword; lw:=round(r); i1:=smallint(lw shr 16); i2:=smallint(lw and $ffff);
如果你是要r实际存储值 r:real; i1,i2:smallint; r:=1.1; i1:=smallint(((PLongWord(@r))^)shr 16); i2:=smallint(((PLongWord(@r))^) and $ffff); 如果你是要把real换成32bit整数值 r:real; i1,i2:smallint; lw:longword; lw:=round(r); i1:=smallint(lw shr 16); i2:=smallint(lw and $ffff);