/[eiffelstudio]/FreeELKS/trunk/library/kernel/natural_8.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/natural_8.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91447 - (show annotations)
Tue Jan 10 13:22:04 2006 UTC (14 years, 1 month ago) by ericb
File size: 4118 byte(s)
Added NATURAL classes

1 indexing
2 description: "Integer values coded on 8 bits"
3 library: "Free implementation of ELKS library"
4 copyright: "Copyright (c) 1986-2005, Eiffel Software and others"
5 license: "Eiffel Forum License v2 (see forum.txt)"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 expanded class NATURAL_8 inherit
10
11 NATURAL_8_REF
12 redefine
13 infix "<",
14 infix "+",
15 infix "-",
16 infix "*",
17 infix "/",
18 prefix "+",
19 infix "//",
20 infix "\\",
21 infix "^",
22 as_natural_8,
23 as_natural_16,
24 as_natural_32,
25 as_natural_64,
26 as_integer_8,
27 as_integer_16,
28 as_integer_32,
29 as_integer_64,
30 to_real_32,
31 to_real_64,
32 to_character,
33 bit_and,
34 bit_or,
35 bit_xor,
36 bit_not,
37 bit_shift_left,
38 bit_shift_right
39 end
40
41 create
42 default_create,
43 make_from_reference
44
45 convert
46 make_from_reference ({NATURAL_8_REF}),
47 to_reference: {NATURAL_8_REF, NUMERIC, COMPARABLE, PART_COMPARABLE, HASHABLE, ANY},
48 to_real_32: {REAL},
49 to_real_64: {DOUBLE},
50 to_integer_16: {INTEGER_16},
51 to_integer_32: {INTEGER},
52 to_integer_64: {INTEGER_64},
53 to_natural_16: {NATURAL_16},
54 to_natural_32: {NATURAL_32},
55 to_natural_64: {NATURAL_64}
56
57 feature -- Comparison
58
59 infix "<" (other: like Current): BOOLEAN is
60 -- Is current integer less than `other'?
61 external
62 "built_in"
63 end
64
65 feature -- Basic operations
66
67 infix "+" (other: like Current): like Current is
68 -- Sum with `other'
69 external
70 "built_in"
71 end
72
73 infix "-" (other: like Current): like Current is
74 -- Result of subtracting `other'
75 external
76 "built_in"
77 end
78
79 infix "*" (other: like Current): like Current is
80 -- Product by `other'
81 external
82 "built_in"
83 end
84
85 infix "/" (other: like Current): DOUBLE is
86 -- Division by `other'
87 external
88 "built_in"
89 end
90
91 prefix "+": like Current is
92 -- Unary plus
93 external
94 "built_in"
95 end
96
97 infix "//" (other: like Current): like Current is
98 -- Integer division of Current by `other'
99 external
100 "built_in"
101 end
102
103 infix "\\" (other: like Current): like Current is
104 -- Remainder of the integer division of Current by `other'
105 external
106 "built_in"
107 end
108
109 infix "^" (other: DOUBLE): DOUBLE is
110 -- Integer power of Current by `other'
111 external
112 "built_in"
113 end
114
115 feature -- Conversion
116
117 as_natural_8: NATURAL_8 is
118 -- Convert `item' into an NATURAL_8 value.
119 external
120 "built_in"
121 end
122
123 as_natural_16: NATURAL_16 is
124 -- Convert `item' into an NATURAL_16 value.
125 external
126 "built_in"
127 end
128
129 as_natural_32: NATURAL_32 is
130 -- Convert `item' into an NATURAL_32 value.
131 external
132 "built_in"
133 end
134
135 as_natural_64: NATURAL_64 is
136 -- Convert `item' into an NATURAL_64 value.
137 external
138 "built_in"
139 end
140
141 as_integer_8: INTEGER_8 is
142 -- Convert `item' into an INTEGER_8 value.
143 external
144 "built_in"
145 end
146
147 as_integer_16: INTEGER_16 is
148 -- Convert `item' into an INTEGER_16 value.
149 external
150 "built_in"
151 end
152
153 as_integer_32: INTEGER is
154 -- Convert `item' into an INTEGER_32 value.
155 external
156 "built_in"
157 end
158
159 as_integer_64: INTEGER_64 is
160 -- Convert `item' into an INTEGER_64 value.
161 external
162 "built_in"
163 end
164
165 to_real_32: REAL is
166 -- Convert `item' into a REAL
167 external
168 "built_in"
169 end
170
171 to_real_64: DOUBLE is
172 -- Convert `item' into a DOUBLE
173 external
174 "built_in"
175 end
176
177 to_character: CHARACTER is
178 -- Returns corresponding ASCII character to `item' value.
179 external
180 "built_in"
181 end
182
183 feature -- Bit operations
184
185 bit_and (i: like Current): like Current is
186 -- Bitwise and between Current' and `i'.
187 external
188 "built_in"
189 end
190
191 bit_or (i: like Current): like Current is
192 -- Bitwise or between Current' and `i'.
193 external
194 "built_in"
195 end
196
197 bit_xor (i: like Current): like Current is
198 -- Bitwise xor between Current' and `i'.
199 external
200 "built_in"
201 end
202
203 bit_not: like Current is
204 -- One's complement of Current.
205 external
206 "built_in"
207 end
208
209 bit_shift_left (n: INTEGER): like Current is
210 -- Shift Current from `n' position to left.
211 external
212 "built_in"
213 end
214
215 bit_shift_right (n: INTEGER): like Current is
216 -- Shift Current from `n' position to right.
217 external
218 "built_in"
219 end
220
221 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23