Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fheLib precompile for all internal functions #144

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions codegen/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type Operator = {
leftScalarEncrypt?: boolean;
// disable left scalar operator
leftScalarDisable?: boolean;
fheLibName?: string;
};

export type Precompile = {
Expand Down Expand Up @@ -104,6 +105,7 @@ export const ALL_OPERATORS: Operator[] = [
hasEncrypted: true,
arguments: OperatorArguments.Binary,
returnType: ReturnType.Uint,
fheLibName: 'fheBitAnd',
},
{
name: 'or',
Expand All @@ -112,6 +114,7 @@ export const ALL_OPERATORS: Operator[] = [
hasEncrypted: true,
arguments: OperatorArguments.Binary,
returnType: ReturnType.Uint,
fheLibName: 'fheBitOr',
},
{
name: 'xor',
Expand All @@ -120,6 +123,7 @@ export const ALL_OPERATORS: Operator[] = [
hasEncrypted: true,
arguments: OperatorArguments.Binary,
returnType: ReturnType.Uint,
fheLibName: 'fheBitXor',
},
{
name: 'shl',
Expand Down
15 changes: 15 additions & 0 deletions codegen/overloadTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ type OverloadTest = {
};

export const overloadTests: { [methodName: string]: OverloadTest[] } = {
neg_euint8: [
{ inputs: [0x01], output: 0xff },
{ inputs: [0x02], output: 0xfe },
],
not_euint8: [{ inputs: [0x03], output: 0xfc }],
neg_euint16: [
{ inputs: [0x0001], output: 0xffff },
{ inputs: [0x0002], output: 0xfffe },
],
not_euint16: [{ inputs: [0x00f1], output: 0xff0e }],
neg_euint32: [
{ inputs: [0x00000001], output: 0xffffffff },
{ inputs: [0x00000002], output: 0xfffffffe },
],
not_euint32: [{ inputs: [0x0000fffe], output: 0xffff0001 }],
add_euint8_euint8: [{ inputs: [3, 4], output: 7 }],
sub_euint8_euint8: [{ inputs: [4, 3], output: 1 }],
mul_euint8_euint8: [{ inputs: [3, 4], output: 12 }],
Expand Down
Loading