Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/eXene/lib/misc/xvalid.sml
ViewVC logotype

Annotation of /sml/trunk/src/eXene/lib/misc/xvalid.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 2 (* xvalid.sml
2 :     *
3 :     * COPYRIGHT (c) 1992 by AT&T Bell Laboratories. See COPYRIGHT file for details.
4 :     *)
5 :    
6 :     structure XValid : sig
7 :    
8 :     val valid8 : int -> bool
9 :     val validWord8 : word -> bool
10 :     val validSigned8 : int -> bool
11 :     val valid16 : int -> bool
12 :     val validWord16 : word -> bool
13 :     val validSigned16 : int -> bool
14 :    
15 :     end = struct
16 :    
17 :     val not8 = Word.notb 0wxFF
18 :     val not16 = Word.notb 0wxFFFF
19 :    
20 :     fun andb (i, mask) = Word.andb(Word.fromInt i, mask)
21 :    
22 :     fun validWord8 w = (Word.andb(w, not8) = 0w0)
23 :     fun valid8 i = validWord8 (Word.fromInt i)
24 :     fun validSigned8 i = (i < 128) andalso (i >= ~128)
25 :    
26 :     fun validWord16 w = (Word.andb(w, not16) = 0w0)
27 :     fun valid16 i = validWord16 (Word.fromInt i)
28 :     fun validSigned16 i = (i < 32768) andalso (i >= ~32768)
29 :    
30 :     end (* XValid *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0