-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from 0xjei/feat/r1cs-info
Optimize `r1cs` info reader
- Loading branch information
Showing
4 changed files
with
90 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {readSync, ReadPosition} from 'fs'; | ||
|
||
/** Reads a specified number of bytes from a file and converts them to a BigInt. | ||
*/ | ||
export function readBytesFromFile(fd: number, offset: number, length: number, position: ReadPosition): BigInt { | ||
const buffer = Buffer.alloc(length); | ||
|
||
readSync(fd, buffer, offset, length, position); | ||
|
||
return BigInt(`0x${buffer.reverse().toString('hex')}`); | ||
} |