summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/T7507.hs
blob: 04f156d8716a45dcf49c132c6b290230efb9f421 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Main where

import Data.Int
import System.Environment

bitcount x = if x > 0 
    then let (d,m) = divMod x 2 in  bitcount d + m
    else 0

main = print $ sum  $ map bitcount 
       [ 0 :: Int64 .. 2^20 - 1 ]