タイトル : Re^3: 64Bitの整数値を32Bitずつにしたい 投稿日 : 2005/12/28(Wed) 10:05 投稿者 : 魔界の仮面弁士
> 実際、Long型64Bitの整数値には、2147483647以上の値が入ります。 > (なので、Int32にはそのままキャストできないのです。) とりあえずは、 Dim L As Long = &HFEDCBA9876543210L Dim B() As Byte = BitConverter.GetBytes(L) Dim I1 As Integer = BitConverter.ToInt32(B, 0) Dim I2 As Integer = BitConverter.ToInt32(B, 4) MessageBox.Show(String.Format("&H{0:X8}, &H{1:X8}", I1, I2)) とか。 あるいは、 Dim L As Long = &HFEDCBA9876543210L Dim I1, I2 As Integer Dim S As New IO.MemoryStream(64) With New IO.BinaryWriter(S) .Write(L) End With S.Position = 0 With New IO.BinaryReader(S) I1 = .ReadInt32() I2 = .ReadInt32() End With S.Close() MessageBox.Show(String.Format("&H{0:X8}, &H{1:X8}", I1, I2)) とか。 |