@@ -11,7 +11,10 @@ import {
11
11
type ScalarShape ,
12
12
} from '@h5web/shared/hdf5-models' ;
13
13
import { type OnProgress } from '@h5web/shared/react-suspense-fetch' ;
14
- import { type TypedArrayConstructor } from '@h5web/shared/vis-models' ;
14
+ import {
15
+ type BigIntTypedArrayConstructor ,
16
+ type TypedArrayConstructor ,
17
+ } from '@h5web/shared/vis-models' ;
15
18
import { type AxiosProgressEvent , isAxiosError } from 'axios' ;
16
19
17
20
import { type DataProviderApi } from './api' ;
@@ -33,7 +36,7 @@ export function typedArrayFromDType(
33
36
return Int16Array ;
34
37
case 32 :
35
38
return Int32Array ;
36
- case 64 : // No support for 64-bit integer values in JS
39
+ case 64 : // combine with `bigIntTypedArrayFromDType` when relevant
37
40
return undefined ;
38
41
}
39
42
}
@@ -46,14 +49,15 @@ export function typedArrayFromDType(
46
49
return Uint16Array ;
47
50
case 32 :
48
51
return Uint32Array ;
49
- case 64 : // No support for 64-bit unsigned integer values in JS
52
+ case 64 : // combine with `bigIntTypedArrayFromDType` when relevant
50
53
return undefined ;
51
54
}
52
55
}
53
56
54
57
if ( isFloatType ( dtype ) ) {
55
58
switch ( dtype . size ) {
56
- case 16 : // No support for 16-bit floating values in JS
59
+ case 16 : // no support for 16-bit floating values in JS
60
+ case 128 : // no support for 128-bit floating values in JS
57
61
return undefined ;
58
62
case 32 :
59
63
return Float32Array ;
@@ -65,6 +69,16 @@ export function typedArrayFromDType(
65
69
return undefined ;
66
70
}
67
71
72
+ export function bigIntTypedArrayFromDType (
73
+ dtype : DType ,
74
+ ) : BigIntTypedArrayConstructor | undefined {
75
+ if ( ! isIntegerType ( dtype ) || dtype . size !== 64 ) {
76
+ return undefined ;
77
+ }
78
+
79
+ return dtype . signed ? BigInt64Array : BigUint64Array ;
80
+ }
81
+
68
82
export async function getValueOrError (
69
83
api : DataProviderApi ,
70
84
dataset : Dataset < ArrayShape | ScalarShape > ,
0 commit comments