note description: "References to objects containing an integer value coded on 32 bits" library: "Free implementation of ELKS library" status: "See notice at end of class." legal: "See notice at end of class." date: "$Date: 2020-05-19 14:18:09 +0000 (Tue, 19 May 2020) $" revision: "$Revision: 104255 $" class interface INTEGER_32_REF create default_create feature -- Access item: INTEGER_32 -- Integer value hash_code: INTEGER_32 -- Hash code value sign: INTEGER_32 -- Sign value (0, -1 or 1) ensure three_way: Result = three_way_comparison (zero) one: like Current -- Neutral element for "*" and "/" zero: like Current -- Neutral element for "+" and "-" Min_value: INTEGER_32 = -2147483648 Max_value: INTEGER_32 = 2147483647 -- Minimum and Maximum value hold in item. feature -- Comparison is_less alias "<" (other: like Current): BOOLEAN -- Is current integer less than other? is_equal (other: like Current): BOOLEAN -- Is other attached to an object of the same type -- as current object and identical to it? feature -- Element change set_item (i: INTEGER_32) -- Make i the item value. ensure item_set: item = i feature -- Status report divisible (other: like Current): BOOLEAN -- May current object be divided by other? ensure then value: Result = (other.item /= 0) exponentiable (other: NUMERIC): BOOLEAN -- May current object be elevated to the power other? ensure then safe_values: ((other.conforms_to (0) and item /= 0) or (other.conforms_to (0.0) and item > 0)) implies Result is_hashable: BOOLEAN -- May current object be hashed? -- (True if it is not its type's default.) is_valid_character_8_code: BOOLEAN -- Does current object represent a CHARACTER_8? ensure in_bounds: Result = (item >= {CHARACTER_8}.min_value and item <= {CHARACTER_8}.max_value) is_valid_character_32_code: BOOLEAN -- Does current object represent a CHARACTER_32? ensure in_bounds: Result = (item >= 0 and item.to_natural_32 >= {CHARACTER_32}.min_value and item.to_natural_32 <= {CHARACTER_32}.max_value) feature -- Basic operations abs: INTEGER_32 -- Absolute value ensure non_negative: Result >= 0 same_absolute_value: (Result = item) or (Result = - item) plus alias "+" (other: like Current): like Current -- Sum with other minus alias "-" alias "−" (other: like Current): like Current -- Result of subtracting other product alias "*" alias "×" (other: like Current): like Current -- Product by other quotient alias "/" alias "÷" (other: like Current): REAL_64 -- Division by other require other_exists: other /= Void good_divisor: divisible (other) identity alias "+": like Current -- Unary plus opposite alias "-" alias "−": like Current -- Unary minus integer_quotient alias "//" (other: like Current): like Current -- Integer division of Current by other integer_remainder alias "\\" (other: like Current): like Current -- Remainder of the integer division of Current by other require other_exists: other /= Void good_divisor: divisible (other) ensure result_exists: Result /= Void power alias "^" (other: REAL_64): REAL_64 -- Integer power of Current by other interval alias "|..|" (other: INTEGER_32): INTEGER_INTERVAL -- Interval from current element to other -- (empty if other less than current integer) feature -- Conversion to_reference: INTEGER_32_REF -- Associated reference of Current ensure to_reference_not_void: Result /= Void frozen to_boolean: BOOLEAN -- True if not zero. as_natural_8: NATURAL_8 -- Convert item into an NATURAL_8 value. as_natural_16: NATURAL_16 -- Convert item into an NATURAL_16 value. as_natural_32: NATURAL_32 -- Convert item into an NATURAL_32 value. as_natural_64: NATURAL_64 -- Convert item into an NATURAL_64 value. as_integer_8: INTEGER_8 -- Convert item into an INTEGER_8 value. as_integer_16: INTEGER_16 -- Convert item into an INTEGER_16 value. as_integer_32: INTEGER_32 -- Convert item into an INTEGER_32 value. as_integer_64: INTEGER_64 -- Convert item into an INTEGER_64 value. frozen to_natural_8: NATURAL_8 -- Convert item into an NATURAL_8 value. require item_non_negative: item >= 0 not_too_big: item <= {NATURAL_8}.max_value.to_integer_32 frozen to_natural_16: NATURAL_16 -- Convert item into an NATURAL_16 value. require item_non_negative: item >= 0 not_too_big: item <= {NATURAL_16}.max_value.to_integer_32 frozen to_natural_32: NATURAL_32 -- Convert item into an NATURAL_32 value. require item_non_negative: item >= 0 frozen to_natural_64: NATURAL_64 -- Convert item into an NATURAL_64 value. require item_non_negative: item >= 0 frozen to_integer_8: INTEGER_8 -- Convert item into an INTEGER_8 value. require not_too_small: item >= {INTEGER_8}.min_value.to_integer_32 not_too_big: item <= {INTEGER_8}.max_value.to_integer_32 frozen to_integer_16: INTEGER_16 -- Convert item into an INTEGER_16 value. require not_too_small: item >= {INTEGER_16}.min_value.to_integer_32 not_too_big: item <= {INTEGER_16}.max_value.to_integer_32 frozen to_integer: INTEGER_32 -- Return item. -- Was declared in INTEGER_32_REF as synonym of to_integer_32. frozen to_integer_32: INTEGER_32 -- Return item. -- Was declared in INTEGER_32_REF as synonym of to_integer. frozen to_integer_64: INTEGER_64 -- Convert item into an INTEGER_64 value. to_real: REAL_32 -- Convert item into a REAL_32 to_double: REAL_64 -- Convert item into a REAL_64 to_hex_string: STRING_8 -- Convert item into an hexadecimal string. ensure result_not_void: Result /= Void result_valid_count: Result.count = {PLATFORM}.integer_32_bits // 4 to_hex_character: CHARACTER_8 -- Convert item into an hexadecimal character. require in_bounds: 0 <= item and item <= 15 ensure valid_character: ("0123456789ABCDEF").has (Result) to_character_8: CHARACTER_8 -- Associated character in 8 bit version. require valid_character: is_valid_character_8_code to_character_32: CHARACTER_32 -- Associated character in 32 bit version. require valid_character: is_valid_character_32_code feature -- Bit operations bit_and alias "&" alias "⊗" (i: like Current): like Current -- Bitwise and between Current' and i. require i_not_void: i /= Void ensure bitwise_and_not_void: Result /= Void bit_or alias "|" alias "⦶" (i: like Current): like Current -- Bitwise or between Current' and i. require i_not_void: i /= Void ensure bitwise_or_not_void: Result /= Void bit_xor alias "⊕" (i: like Current): like Current -- Bitwise xor between Current' and i. require i_not_void: i /= Void ensure bitwise_xor_not_void: Result /= Void bit_not alias "⊝": like Current -- One's complement of Current. ensure bit_not_not_void: Result /= Void frozen bit_shift (n: INTEGER_32): INTEGER_32 -- Shift Current from n position to right if n positive, -- to left otherwise. require n_less_or_equal_to_32: n <= 32 n_greater_or_equal_to_minus_32: n >= -32 bit_shift_left alias "|<<" alias "⧀" (n: INTEGER_32): like Current -- Shift Current from n position to left. require n_nonnegative: n >= 0 n_less_or_equal_to_32: n <= 32 ensure bit_shift_left_not_void: Result /= Void bit_shift_right alias "|>>" alias "⧁" (n: INTEGER_32): like Current -- Shift Current from n position to right. require n_nonnegative: n >= 0 n_less_or_equal_to_32: n <= 32 ensure bit_shift_right_not_void: Result /= Void frozen bit_test (n: INTEGER_32): BOOLEAN -- Test n-th position of Current. require n_nonnegative: n >= 0 n_less_than_32: n < 32 frozen set_bit (b: BOOLEAN; n: INTEGER_32): INTEGER_32 -- Copy of current with n-th position -- set to 1 if b, 0 otherwise. require n_nonnegative: n >= 0 n_less_than_32: n < 32 frozen set_bit_with_mask (b: BOOLEAN; m: INTEGER_32): INTEGER_32 -- Copy of current with all 1 bits of m set to 1 -- if b, 0 otherwise. feature -- Output out: STRING_8 -- Printable representation of integer value invariant sign_times_abs: sign * abs = item note copyright: "Copyright (c) 1984-2020, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class INTEGER_32_REF
Generated by ISE EiffelStudio