Skip to content

Commit

Permalink
Seekreadcompresseduint32 to struct tuple (#9222)
Browse files Browse the repository at this point in the history
* seekReadTypeDefRowExtents returns a struct tuple

* seekReadCompressedUInt32 returns a struct tuple
  • Loading branch information
cartermp authored May 26, 2020
1 parent 757630f commit 464bdc6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/absil/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ let seekReadUInt16AsInt32 mdv addr = int32 (seekReadUInt16 mdv addr)

let seekReadCompressedUInt32 mdv addr =
let b0 = seekReadByte mdv addr
if b0 <= 0x7Fuy then int b0, addr+1
if b0 <= 0x7Fuy then struct (int b0, addr+1)
elif b0 <= 0xBFuy then
let b0 = b0 &&& 0x7Fuy
let b1 = seekReadByteAsInt32 mdv (addr+1)
(int b0 <<< 8) ||| int b1, addr+2
struct ((int b0 <<< 8) ||| int b1, addr+2)
else
let b0 = b0 &&& 0x3Fuy
let b1 = seekReadByteAsInt32 mdv (addr+1)
let b2 = seekReadByteAsInt32 mdv (addr+2)
let b3 = seekReadByteAsInt32 mdv (addr+3)
(int b0 <<< 24) ||| (int b1 <<< 16) ||| (int b2 <<< 8) ||| int b3, addr+4
struct ((int b0 <<< 24) ||| (int b1 <<< 16) ||| (int b2 <<< 8) ||| int b3, addr+4)

let seekReadSByte mdv addr = sbyte (seekReadByte mdv addr)
let seekReadSingle mdv addr = singleOfBits (seekReadInt32 mdv addr)
Expand All @@ -226,11 +226,11 @@ let seekReadUTF8String mdv addr =
System.Text.Encoding.UTF8.GetString (bytes, 0, bytes.Length)

let seekReadBlob mdv addr =
let len, addr = seekReadCompressedUInt32 mdv addr
let struct (len, addr) = seekReadCompressedUInt32 mdv addr
seekReadBytes mdv addr len

let seekReadUserString mdv addr =
let len, addr = seekReadCompressedUInt32 mdv addr
let struct (len, addr) = seekReadCompressedUInt32 mdv addr
let bytes = seekReadBytes mdv addr (len - 1)
Encoding.Unicode.GetString(bytes, 0, bytes.Length)

Expand Down

0 comments on commit 464bdc6

Please sign in to comment.