Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Disarm/InternalDisassembly/Arm64CommonUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,10 @@ public static double DecodeFPImm(uint pType, uint imm8)
//Finally add bits 5 and 4
exp |= (imm8 & 0b0011_0000U) >> 4;

var frac = imm8 & 0b0000_1111U;
frac <<= f - 4; //Append f - 4 0s
// Keep the shifted fraction 64-bit: the 64-bit format needs a 48-bit shift, and shifting a
// 32-bit value would wrap the count modulo 32, parking the fraction nibble at bit 16
// instead of bit 48 (e.g. `fmov d16, #15.0` decoded as 8.000000001629815).
var frac = (ulong)(imm8 & 0b0000_1111U) << (f - 4); //Append f - 4 0s

var resultBits = (signBit ? 1UL : 0UL) << (n - 1);
resultBits |= (ulong)exp << f;
Expand Down