diff --git a/src/bitcode.ts b/src/bitcode.ts index 690287e..7ef6649 100644 --- a/src/bitcode.ts +++ b/src/bitcode.ts @@ -19,8 +19,8 @@ export class Builder { return new types.Void(); } - public static i(width: number): types.Int { - return new types.Int(width); + public static i(width: number, signed: boolean = false): types.Int { + return new types.Int(width, signed); } public static signature(returnType: Type, params: Type[]): types.Signature { diff --git a/src/types/int.ts b/src/types/int.ts index 6c5bd54..9076c24 100644 --- a/src/types/int.ts +++ b/src/types/int.ts @@ -2,7 +2,7 @@ import * as values from '../values'; import { Type } from './base'; export class Int extends Type { - constructor(public readonly width: number) { + constructor(public readonly width: number, public readonly signed: boolean = false) { super('i' + width); } @@ -16,7 +16,7 @@ export class Int extends Type { } const toInt = to as Int; - return toInt.width === this.width; + return toInt.width === this.width && toInt.signed === this.signed; } public val(num: number): values.constants.Int {