mirror of
https://github.com/logos-storage/logos-storage-proofs-circuits.git
synced 2026-01-03 14:03:06 +00:00
32 lines
770 B
Haskell
32 lines
770 B
Haskell
|
|
|
||
|
|
module CircuitCommon
|
||
|
|
( module R1CS
|
||
|
|
, module System.FilePath
|
||
|
|
, circuitSourceDir
|
||
|
|
, toBitsLE , toBitsLE'
|
||
|
|
)
|
||
|
|
where
|
||
|
|
|
||
|
|
--------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
import Data.Bits
|
||
|
|
import System.FilePath
|
||
|
|
import R1CS
|
||
|
|
|
||
|
|
--------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
circuitSourceDir :: FilePath
|
||
|
|
circuitSourceDir = "../circuit"
|
||
|
|
|
||
|
|
--------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
toBitsLE :: Integer -> [Int]
|
||
|
|
toBitsLE = go where
|
||
|
|
go 0 = []
|
||
|
|
go n = fromInteger (n .&. 1) : go (shiftR n 1)
|
||
|
|
|
||
|
|
toBitsLE' :: Int -> Integer -> [Int]
|
||
|
|
toBitsLE' n what = take n (toBitsLE what ++ repeat 0)
|
||
|
|
|
||
|
|
--------------------------------------------------------------------------------
|