Skip to content

Commit 2851540

Browse files
aha66pavanky
authored andcommitted
Add support for short types
* Update array.py * Update util.py * Update util.py
1 parent 2efb2ad commit 2851540

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

arrayfire/array.py

Lines changed: 4 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def get_reversion():
9494
'd' : Dtype.f64,
9595
'b' : Dtype.b8,
9696
'B' : Dtype.u8,
97+
'h' : Dtype.s16,
98+
'H' : Dtype.u16,
9799
'i' : Dtype.s32,
98100
'I' : Dtype.u32,
99101
'l' : Dtype.s64,
@@ -105,6 +107,8 @@ def get_reversion():
105107
Dtype.f64.value : 'd',
106108
Dtype.b8.value : 'b',
107109
Dtype.u8.value : 'B',
110+
Dtype.s16.value : 'h',
111+
Dtype.u16.value : 'H',
108112
Dtype.s32.value : 'i',
109113
Dtype.u32.value : 'I',
110114
Dtype.s64.value : 'l',
@@ -116,6 +120,8 @@ def get_reversion():
116120
Dtype.f64.value : ct.c_double,
117121
Dtype.b8.value : ct.c_char,
118122
Dtype.u8.value : ct.c_ubyte,
123+
Dtype.s16.value : ct.c_short,
124+
Dtype.u16.value : ct.c_ushort,
119125
Dtype.s32.value : ct.c_int,
120126
Dtype.u32.value : ct.c_uint,
121127
Dtype.s64.value : ct.c_longlong,
@@ -127,6 +133,8 @@ def get_reversion():
127133
Dtype.f64.value : 'double',
128134
Dtype.b8.value : 'bool',
129135
Dtype.u8.value : 'unsigned char',
136+
Dtype.s16.value : 'short int',
137+
Dtype.u16.value : 'unsigned short int',
130138
Dtype.s32.value : 'int',
131139
Dtype.u32.value : 'unsigned int',
132140
Dtype.s64.value : 'long int',

0 commit comments

Comments
 (0)