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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91448 - (show annotations)
Tue Jan 10 13:22:50 2006 UTC (14 years ago) by ericb
File size: 4029 byte(s)
Updated INTEGER classes to be in sync with ISE Eiffel
and to use "built_in" external features.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23