indexing description: "[ Class for wrapping C int8 arrays for passing them to SDL. ]" date: "$Date$" revision: "$Revision$" class EM_INT8_ARRAY inherit EWG_ARRAY create make_new_unshared, make_new_shared, make_unshared, make_shared feature {ANY} -- Access item (i: INTEGER): INTEGER is -- Return `i'-th item require exists: exists valid_index: is_valid_index (i) do Result := managed_data.read_integer_8 (i * item_size) end put (v: INTEGER; i: INTEGER) is -- Replace `i'-th entry by `v' require exists: exists valid_index: is_valid_index (i) do managed_data.put_integer_8 (v, i * item_size) ensure integer_set: item (i) = v end copy_from (other: like current) is -- copy from other require other_not_to_big: other.count <= count do copy_from_position_to_count (other, 0, 0, other.count) end copy_from_count (other: like current; cnt: INTEGER) is -- copy from other cnt items require current_big_enough: count >= cnt other_big_enough: other.count >= cnt do copy_from_position_to_count (other, 0, 0, cnt) end copy_from_position (other: like current; position: INTEGER) is -- copy from other starting at position require position_valid: position >= 0 and position < other.count other_not_to_big: other.count <= position + count do copy_from_position_to_count (other, position, 0, other.count) end copy_from_position_count (other: like current; position, cnt: INTEGER) is -- copy from other starting at position cnt items require position_valid: position >= 0 and position < other.count other_big_enough: other.count >= position + cnt current_big_enough: count >= cnt do copy_from_position_to_count (other, position, 0, cnt) end copy_from_to (other: like current; to_position: INTEGER) is -- copy from other to starting position to_position require to_position_valid: to_position >= 0 and to_position < count other_not_to_big: other.count + to_position <= count do copy_from_position_to_count (other, 0, to_position, other.count) end copy_from_to_count (other: like current; to_position, cnt: INTEGER) is -- copy from other to starting position to_position cnt items require to_position_valid: to_position >= 0 and to_position < count other_big_enough: other.count >= cnt current_big_enough: count >= to_position + cnt do copy_from_position_to_count (other, 0, to_position, cnt) end copy_from_position_to (other: like current; position, to_position: INTEGER) is -- copy from other starting at position to to_position require position_valid: position >= 0 and position < other.count to_position_valid: to_position >= 0 and to_position < count other_not_to_big: other.count + to_position <= count + position do copy_from_position_to_count (other, position, to_position, other.count) end copy_from_position_to_count (other: like current; position, to_position, cnt: INTEGER) is -- copy from other starting at position to to_position cnt items require position_valid: position >= 0 and position < other.count to_position_valid: to_position >= 0 and to_position < count other_big_enough: other.count >= position + cnt current_big_enough: count >= to_position + cnt local dummy_pointer: POINTER do dummy_pointer := external_memory.memcpy_external (array_address + (to_position * item_size), other.array_address + (position * item_size), cnt * item_size) end feature {NONE} -- Implementation item_size: INTEGER is -- Size in bytes. once Result := 1 end end