15 lines
339 B
Plaintext
15 lines
339 B
Plaintext
|
module Base64 where
|
||
|
|
||
|
import Prelude (($), (+), (/), (-))
|
||
|
import Data.Int (toNumber, floor)
|
||
|
import Data.Number ((%))
|
||
|
|
||
|
datasize2b64size :: Int -> Int
|
||
|
datasize2b64size v =
|
||
|
let x = toNumber v
|
||
|
remainder = x % 24.0
|
||
|
additional_chars = (x / 24.0) + (32.0 - remainder) / 8.0
|
||
|
base = x / 8.0
|
||
|
in floor $ base + additional_chars
|
||
|
|