Skip to content

Commit

Permalink
Fixed caps in cpuSubtype
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Jan 19, 2025
1 parent d67f698 commit aeeaf81
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions macho/architecture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ import { Architecture } from './architecture.ts';
Deno.test('constructor()', () => {
const a = new Architecture();
assertEquals(a.cpuType(), 0);
assertEquals(a.cpuSubType(), 0);
assertEquals(a.cpuSubtype(), 0);
assertEquals(a.cpuSubtypeFull(), 0);
});

Deno.test('constructor(type)', () => {
const a = new Architecture(0x12345678);
assertEquals(a.cpuType(), 0x12345678);
assertEquals(a.cpuSubType(), 0xffffff);
assertEquals(a.cpuSubtype(), 0xffffff);
assertEquals(a.cpuSubtypeFull(), -1);
});

Deno.test('constructor(type, sub)', () => {
const a = new Architecture(0x12345678, 0x23456789);
assertEquals(a.cpuType(), 0x12345678);
assertEquals(a.cpuSubType(), 0x456789);
assertEquals(a.cpuSubtype(), 0x456789);
assertEquals(a.cpuSubtypeFull(), 0x23456789);
});

Expand All @@ -37,7 +37,7 @@ Deno.test('constructor(archInFile: FatArch)', () => {
f.cpusubtype = 0x23456789;
const a = new Architecture(f);
assertEquals(a.cpuType(), 0x12345678);
assertEquals(a.cpuSubType(), 0x456789);
assertEquals(a.cpuSubtype(), 0x456789);
assertEquals(a.cpuSubtypeFull(), 0x23456789);
});

Expand All @@ -47,7 +47,7 @@ Deno.test('constructor(archInFile: FatArch64)', () => {
f.cpusubtype = 0x23456789;
const a = new Architecture(f);
assertEquals(a.cpuType(), 0x12345678);
assertEquals(a.cpuSubType(), 0x456789);
assertEquals(a.cpuSubtype(), 0x456789);
assertEquals(a.cpuSubtypeFull(), 0x23456789);
});

Expand Down
2 changes: 1 addition & 1 deletion macho/architecture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class Architecture {
*
* @returns Masked subtype ID.
*/
public cpuSubType(): number {
public cpuSubtype(): number {
return this.second & ~CPU_SUBTYPE_MASK;
}

Expand Down
2 changes: 1 addition & 1 deletion macho/machobase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Deno.test('init', () => {
assertEquals(macho.isFlipped(), flip, tag);
assertEquals(macho.is64(), bits === 64, tag);
assertEquals(macho.architecture().cpuType(), 2, tag);
assertEquals(macho.architecture().cpuSubType(), 3, tag);
assertEquals(macho.architecture().cpuSubtype(), 3, tag);
assertEquals(macho.type(), 4, tag);
assertEquals(macho.flags(), 5, tag);
assertEquals(macho.headerSize(), header.byteLength, tag);
Expand Down

0 comments on commit aeeaf81

Please sign in to comment.