Fix constant encoding for float/double

Fix #409
This commit is contained in:
yck1509 2016-01-10 20:32:36 +08:00
Родитель c7cd8de6f2
Коммит 78e78fae06
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -56,7 +56,7 @@ namespace Confuser.Protections.Constants {
else if (entry.Key is float) { else if (entry.Key is float) {
var t = new RTransform(); var t = new RTransform();
t.R4 = (float)entry.Key; t.R4 = (float)entry.Key;
EncodeConstant32(moduleCtx, t.Hi, context.CurrentModule.CorLibTypes.Single, entry.Value); EncodeConstant32(moduleCtx, t.Lo, context.CurrentModule.CorLibTypes.Single, entry.Value);
} }
else if (entry.Key is double) { else if (entry.Key is double) {
var t = new RTransform(); var t = new RTransform();
@ -348,8 +348,8 @@ namespace Confuser.Protections.Constants {
[FieldOffset(0)] public float R4; [FieldOffset(0)] public float R4;
[FieldOffset(0)] public double R8; [FieldOffset(0)] public double R8;
[FieldOffset(0)] public readonly uint Hi; [FieldOffset(4)] public readonly uint Hi;
[FieldOffset(4)] public readonly uint Lo; [FieldOffset(0)] public readonly uint Lo;
} }
} }
} }