1 (* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
8 functor CharSize (S: CHAR_SIZE_STRUCTS): CHAR_SIZE =
13 datatype t = C8 | C16 | C32
15 val all = [C8, C16, C32]
31 | _ => Error.bug "CharSize.frombits"
45 val cardinality = memoize (fn s => IntInf.pow (2, Bits.toInt (bits s)))
47 fun isInRange (s, i) = 0 <= i andalso i < cardinality s