Commit 5b87ebf2 by Nicolas Capens

Fix operator precedence issue.

Addition evaluates before the ternary operator, which resulted in the wrong sizes being computed. Bug 28346104 Change-Id: Id28843132097a4fb1599eed19c05f479f16f1315 Reviewed-on: https://swiftshader-review.googlesource.com/5187Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent cce6c4e1
...@@ -108,7 +108,7 @@ namespace sw ...@@ -108,7 +108,7 @@ namespace sw
DOSheader.e_lfanew = sizeof(DOSheader); DOSheader.e_lfanew = sizeof(DOSheader);
int base = 0x10000000; int base = 0x10000000;
int codePage = pageAlign(sizeof(DOSheader) + AMD64 ? sizeof(COFFheader64) : sizeof(COFFheader32)); int codePage = pageAlign(sizeof(DOSheader) + (AMD64 ? sizeof(COFFheader64) : sizeof(COFFheader32)));
int exportsPage = codePage + pageAlign(codeSize); int exportsPage = codePage + pageAlign(codeSize);
int exportsSize = (int)(sizeof(IMAGE_EXPORT_DIRECTORY) + functionList.size() * sizeof(void*) + (strlen(dllName) + 1)); int exportsSize = (int)(sizeof(IMAGE_EXPORT_DIRECTORY) + functionList.size() * sizeof(void*) + (strlen(dllName) + 1));
int relocPage = exportsPage + pageAlign(exportsSize); int relocPage = exportsPage + pageAlign(exportsSize);
...@@ -227,7 +227,7 @@ namespace sw ...@@ -227,7 +227,7 @@ namespace sw
textSection.Misc.VirtualSize = pageAlign(codeSize); textSection.Misc.VirtualSize = pageAlign(codeSize);
textSection.VirtualAddress = codePage; textSection.VirtualAddress = codePage;
textSection.SizeOfRawData = fileAlign(codeSize); textSection.SizeOfRawData = fileAlign(codeSize);
textSection.PointerToRawData = fileAlign(sizeof(DOSheader) + AMD64 ? sizeof(COFFheader64) : sizeof(COFFheader32)); textSection.PointerToRawData = fileAlign(sizeof(DOSheader) + (AMD64 ? sizeof(COFFheader64) : sizeof(COFFheader32)));
textSection.PointerToRelocations = 0; textSection.PointerToRelocations = 0;
textSection.PointerToLinenumbers = 0; textSection.PointerToLinenumbers = 0;
textSection.NumberOfRelocations = 0; textSection.NumberOfRelocations = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment