@daneren2005/shared-memory-objects 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared-memory-objects.js +496 -433
- package/dist/shared-memory-objects.js.map +1 -1
- package/dist/shared-memory-objects.umd.cjs +1 -1
- package/dist/shared-memory-objects.umd.cjs.map +1 -1
- package/dist/src/main.d.ts +2 -0
- package/dist/src/shared-pool.d.ts +3 -2
- package/dist/src/utils/atomic-math.d.ts +4 -0
- package/dist/src/utils/float32-atomics.d.ts +4 -3
- package/dist/src/utils/float64-atomics.d.ts +6 -0
- package/package.json +1 -1
package/dist/src/main.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export * from './interfaces/typed-array';
|
|
|
12
12
|
export * from './interfaces/typed-array-constructor';
|
|
13
13
|
export * from './utils/16-from-32-array';
|
|
14
14
|
export * from './utils/16-from-64-array';
|
|
15
|
+
export * from './utils/atomic-math';
|
|
15
16
|
export * from './utils/float32-atomics';
|
|
17
|
+
export * from './utils/float64-atomics';
|
|
16
18
|
export * from './utils/pointer';
|
|
17
19
|
export * from './lock/simple-lock';
|
|
18
20
|
export * from './lock/read-write-lock';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SharedAllocatedMemory } from './allocated-memory';
|
|
2
2
|
import { TypedArrayConstructor } from './interfaces/typed-array-constructor';
|
|
3
3
|
import { default as MemoryHeap } from './memory-heap';
|
|
4
|
-
export default class SharedPool<T extends Uint32Array | Int32Array | Float32Array = Uint32Array> implements Iterable<T> {
|
|
4
|
+
export default class SharedPool<T extends Uint32Array | Int32Array | Float32Array | Float64Array = Uint32Array> implements Iterable<T> {
|
|
5
5
|
static readonly ALLOCATE_COUNT: number;
|
|
6
6
|
private memory;
|
|
7
7
|
private firstBlock;
|
|
@@ -17,6 +17,7 @@ export default class SharedPool<T extends Uint32Array | Int32Array | Float32Arra
|
|
|
17
17
|
get dataLength(): number;
|
|
18
18
|
private set dataLength(value);
|
|
19
19
|
get bufferLength(): number;
|
|
20
|
+
get byteMultipler(): number;
|
|
20
21
|
constructor(memory: MemoryHeap, config?: SharedPoolConfig<T> | SharedPoolMemory);
|
|
21
22
|
at(index: number): T;
|
|
22
23
|
get(index: number, dataIndex?: number): number;
|
|
@@ -29,7 +30,7 @@ export default class SharedPool<T extends Uint32Array | Int32Array | Float32Arra
|
|
|
29
30
|
free(): void;
|
|
30
31
|
getSharedMemory(): SharedPoolMemory;
|
|
31
32
|
}
|
|
32
|
-
interface SharedPoolConfig<T extends Uint32Array | Int32Array | Float32Array> {
|
|
33
|
+
interface SharedPoolConfig<T extends Uint32Array | Int32Array | Float32Array | Float64Array> {
|
|
33
34
|
maxChunkSize?: number;
|
|
34
35
|
type?: TypedArrayConstructor<T>;
|
|
35
36
|
dataLength?: number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function addAtomicInt(array: Uint32Array | Int32Array, index: number, amount: number, max: number): void;
|
|
2
|
+
export declare function subtractAtomicInt(array: Uint32Array | Int32Array, index: number, amount: number, min: number): void;
|
|
3
|
+
export declare function addAtomicFloat32(array: Float32Array, index: number, amount: number, max: number): void;
|
|
4
|
+
export declare function subtractAtomicFloat(array: Float32Array, index: number, amount: number, min: number): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare function loadFloat32(data: Int32Array | Uint32Array, index: number): number;
|
|
2
|
-
export declare function storeFloat32(data: Int32Array | Uint32Array, index: number, value: number): void;
|
|
1
|
+
export declare function loadFloat32(data: Int32Array | Uint32Array | Float32Array, index: number): number;
|
|
2
|
+
export declare function storeFloat32(data: Int32Array | Uint32Array | Float32Array, index: number, value: number): void;
|
|
3
3
|
export declare function convertInt32ToFloat32(value: number): number;
|
|
4
4
|
export declare function convertFloat32ToInt32(value: number): number;
|
|
5
|
-
export declare function exchangeFloat32(data: Int32Array | Uint32Array, index: number, value: number): number;
|
|
5
|
+
export declare function exchangeFloat32(data: Int32Array | Uint32Array | Float32Array, index: number, value: number): number;
|
|
6
|
+
export declare function compareExchangeFloat32(data: Int32Array | Uint32Array | Float32Array, index: number, expectedValue: number, replacementValue: number): number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function loadFloat64(data: BigInt64Array | Float64Array, index: number): number;
|
|
2
|
+
export declare function storeFloat64(data: BigInt64Array | Float64Array, index: number, value: number): void;
|
|
3
|
+
export declare function convertInt64ToFloat64(value: bigint): number;
|
|
4
|
+
export declare function convertFloat64ToInt64(value: number): bigint;
|
|
5
|
+
export declare function exchangeFloat64(data: BigInt64Array | Float64Array, index: number, value: number): number;
|
|
6
|
+
export declare function compareExchangeFloat64(data: BigInt64Array | Float64Array, index: number, expectedValue: number, replacementValue: number): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daneren2005/shared-memory-objects",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"author": "daneren2005@gmail.com",
|
|
5
5
|
"description": "Creating objects with a SharedArrayBuffer",
|
|
6
6
|
"homepage": "https://github.com/daneren2005/shared-memory-objects#readme",
|