mirror of
https://github.com/logos-storage/logos-storage-proofs-circuits.git
synced 2026-01-02 13:33:07 +00:00
36 lines
868 B
Haskell
36 lines
868 B
Haskell
|
|
module CircuitCommon
|
|
( module R1CS
|
|
, module System.FilePath
|
|
, circuitRootDir
|
|
, circuitLibSourceDir
|
|
, toBitsLE , toBitsLE'
|
|
)
|
|
where
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
import Data.Bits
|
|
import System.FilePath
|
|
import R1CS
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
circuitRootDir :: FilePath
|
|
circuitRootDir = "../circuit"
|
|
|
|
circuitLibSourceDir :: FilePath
|
|
circuitLibSourceDir = circuitRootDir </> "lib"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
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)
|
|
|
|
--------------------------------------------------------------------------------
|