File: BenchPosixString.hs

package info (click to toggle)
haskell-os-string 2.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 332 kB
  • sloc: haskell: 3,283; makefile: 3
file content (34 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns        #-}
{-# LANGUAGE PackageImports      #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MagicHash           #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE QuasiQuotes         #-}
{-# LANGUAGE TypeApplications    #-}

#define OSSTR pstr
#define OS_STRING PosixString
#define OS_CHAR PosixChar


module BenchPosixString (benchMark) where

import           System.OsString.Posix                 (PosixString, pstr)
import qualified System.OsString.Posix                 as S
import           System.OsString.Internal.Types        (PosixChar(..))

#include "Common.hs"

benchStr :: String
benchStr = "PosixString"

w :: Int -> PosixChar
w i = PosixChar (fromIntegral i)

hashWord8 :: PosixChar -> PosixChar
hashWord8 (PosixChar w) = PosixChar . fromIntegral . hashInt . fromIntegral $ w

iw :: PosixChar -> Int
iw (PosixChar w) = fromIntegral w