Skip to content

Commit

Permalink
fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinyu Li authored and Xinyu Li committed Oct 24, 2024
1 parent f4796d0 commit d832727
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions python/ionpy/Port.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,29 @@ def bind(self, v: Union[int, float, Buffer, List[Union[Buffer, int, float]]]):
c_arr = (ctype* len(v))(*v)
self.bind_value = c_arr
if self.type.code_ == TypeCode.Int:
if self.type.bits_ == 8 and ion_port_bind_i8_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 8 and ion_port_bind_i8_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
elif self.type.bits_ == 16 and ion_port_bind_i16_array(self.obj, ctypes.byref(self.bind_value)) != 0:
elif self.type.bits_ == 16 and ion_port_bind_i16_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
elif self.type.bits_ == 32 and ion_port_bind_i32_array(self.obj, ctypes.byref(self.bind_value)) != 0:
elif self.type.bits_ == 32 and ion_port_bind_i32_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
elif self.type.bits_ == 64 and ion_port_bind_i64_array(self.obj, ctypes.byref(self.bind_value)) != 0:
elif self.type.bits_ == 64 and ion_port_bind_i64_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
elif self.type.code_ == TypeCode.Uint:
if self.type.bits_ == 1 and ion_port_bind_u1_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 1 and ion_port_bind_u1_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
if self.type.bits_ == 8 and ion_port_bind_u8_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 8 and ion_port_bind_u8_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
if self.type.bits_ == 16 and ion_port_bind_u16_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 16 and ion_port_bind_u16_array(self.obj,self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
if self.type.bits_ == 32 and ion_port_bind_u32_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 32 and ion_port_bind_u32_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
if self.type.bits_ == 64 and ion_port_bind_u64_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 64 and ion_port_bind_u64_array(self.obj, self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
elif self.type.code_ == TypeCode.Float:
if self.type.bits_ == 32 and ion_port_bind_f32_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 32 and ion_port_bind_f32_array(self.obj,self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')
if self.type.bits_ == 64 and ion_port_bind_f64_array(self.obj, ctypes.byref(self.bind_value)) != 0:
if self.type.bits_ == 64 and ion_port_bind_f64_array(self.obj,self.bind_value, len(v)) != 0:
raise Exception('Invalid operation')

# vector
Expand Down

0 comments on commit d832727

Please sign in to comment.