Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
fix bug in recognizing 64 bit files
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Nov 27, 2011
1 parent ce29a8a commit 1b1b37e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/rt/image.d
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ struct CPU

bool is32bit ()
{
return (header.magic & MH_MAGIC) != 0;
return (header.magic == MH_MAGIC);
}

bool is64bit ()
{
return (header.magic & MH_MAGIC_64) != 0;
return (header.magic == MH_MAGIC_64);
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/rt/memory_osx.d
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum SegRef[5] dataSegs = [{SEG_DATA, SECT_DATA},
ubyte[] getSection(in mach_header* header, intptr_t slide,
in char* segmentName, in char* sectionName)
{
if ((header.magic & MH_MAGIC) != 0)
if (header.magic == MH_MAGIC)
{
auto sect = getsectbynamefromheader(header,
segmentName,
Expand All @@ -55,7 +55,7 @@ ubyte[] getSection(in mach_header* header, intptr_t slide,
return null;

}
else if ((header.magic & MH_MAGIC_64) != 0)
else if (header.magic == MH_MAGIC_64)
{
auto header64 = cast(mach_header_64*) header;
auto sect = getsectbynamefromheader_64(header64,
Expand All @@ -70,7 +70,8 @@ ubyte[] getSection(in mach_header* header, intptr_t slide,
}
return null;
}
return null;
else
return null;
}


Expand Down

0 comments on commit 1b1b37e

Please sign in to comment.