Skip to content

Commit c53dd65

Browse files
aha66pavanky
authored andcommitted
Add support for short types
* Update array.py * Update util.py * Update util.py
1 parent 863f395 commit c53dd65

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

arrayfire/array.py

+4
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ class Array(BaseArray):
300300
- 'd' for double
301301
- 'b' for bool
302302
- 'B' for unsigned char
303+
- 'h' for signed 16 bit integer
304+
- 'H' for unsigned 16 bit integer
303305
- 'i' for signed 32 bit integer
304306
- 'I' for unsigned 32 bit integer
305307
- 'l' for signed 64 bit integer
@@ -311,6 +313,8 @@ class Array(BaseArray):
311313
- Dtype.f64 for double
312314
- Dtype.b8 for bool
313315
- Dtype.u8 for unsigned char
316+
- Dtype.s16 for signed 16 bit integer
317+
- Dtype.u16 for unsigned 16 bit integer
314318
- Dtype.s32 for signed 32 bit integer
315319
- Dtype.u32 for unsigned 32 bit integer
316320
- Dtype.s64 for signed 64 bit integer

arrayfire/util.py

+8
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def get_reversion():
9898
'd' : Dtype.f64,
9999
'b' : Dtype.b8,
100100
'B' : Dtype.u8,
101+
'h' : Dtype.s16,
102+
'H' : Dtype.u16,
101103
'i' : Dtype.s32,
102104
'I' : Dtype.u32,
103105
'l' : Dtype.s64,
@@ -109,6 +111,8 @@ def get_reversion():
109111
Dtype.f64.value : 'd',
110112
Dtype.b8.value : 'b',
111113
Dtype.u8.value : 'B',
114+
Dtype.s16.value : 'h',
115+
Dtype.u16.value : 'H',
112116
Dtype.s32.value : 'i',
113117
Dtype.u32.value : 'I',
114118
Dtype.s64.value : 'l',
@@ -120,6 +124,8 @@ def get_reversion():
120124
Dtype.f64.value : ct.c_double,
121125
Dtype.b8.value : ct.c_char,
122126
Dtype.u8.value : ct.c_ubyte,
127+
Dtype.s16.value : ct.c_short,
128+
Dtype.u16.value : ct.c_ushort,
123129
Dtype.s32.value : ct.c_int,
124130
Dtype.u32.value : ct.c_uint,
125131
Dtype.s64.value : ct.c_longlong,
@@ -131,6 +137,8 @@ def get_reversion():
131137
Dtype.f64.value : 'double',
132138
Dtype.b8.value : 'bool',
133139
Dtype.u8.value : 'unsigned char',
140+
Dtype.s16.value : 'short int',
141+
Dtype.u16.value : 'unsigned short int',
134142
Dtype.s32.value : 'int',
135143
Dtype.u32.value : 'unsigned int',
136144
Dtype.s64.value : 'long int',

0 commit comments

Comments
 (0)