@woosh/meep-engine 3.45.0 → 3.46.0
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/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +5 -1
- package/src/core/binary/hash/XXH128Hash.d.ts +1 -37
- package/src/core/binary/hash/XXH128Hash.d.ts.map +1 -1
- package/src/core/binary/hash/XXH128Hash.js +4 -55
- package/src/core/binary/hash/XXH3_SECRET.d.ts +1 -12
- package/src/core/binary/hash/XXH3_SECRET.d.ts.map +1 -1
- package/src/core/binary/hash/XXH3_SECRET.js +4 -25
- package/src/core/binary/hash/crc32.d.ts +1 -15
- package/src/core/binary/hash/crc32.d.ts.map +1 -1
- package/src/core/binary/hash/crc32.js +4 -96
- package/src/core/binary/hash/xxh3_128.d.ts +1 -9
- package/src/core/binary/hash/xxh3_128.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_128.js +4 -341
- package/src/core/binary/hash/xxh3_64.d.ts +1 -8
- package/src/core/binary/hash/xxh3_64.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_64.js +4 -241
- package/src/core/binary/hash/xxh3_common.d.ts +1 -223
- package/src/core/binary/hash/xxh3_common.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_common.js +90 -476
- package/src/core/collection/array/combine_hash.d.ts +6 -0
- package/src/core/collection/array/combine_hash.d.ts.map +1 -1
- package/src/core/collection/array/combine_hash.js +6 -0
- package/src/core/function/FunctionCompiler.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply.d.ts +3 -0
- package/src/core/geom/3d/mat4/m4_multiply.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply.js +3 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts +30 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.js +106 -0
- package/src/core/geom/ConicRay.js +2 -2
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/geom/Vector4.js +8 -5
- package/src/core/math/hash/XXH128Hash.d.ts +38 -0
- package/src/core/math/hash/XXH128Hash.d.ts.map +1 -0
- package/src/core/math/hash/XXH128Hash.js +55 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts +13 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts.map +1 -0
- package/src/core/math/hash/XXH3_SECRET.js +25 -0
- package/src/core/math/hash/crc32.d.ts +16 -0
- package/src/core/math/hash/crc32.d.ts.map +1 -0
- package/src/core/math/hash/crc32.js +96 -0
- package/src/core/math/hash/xxh3_128.d.ts +10 -0
- package/src/core/math/hash/xxh3_128.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_128.js +341 -0
- package/src/core/math/hash/xxh3_64.d.ts +9 -0
- package/src/core/math/hash/xxh3_64.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_64.js +241 -0
- package/src/core/math/hash/xxh3_common.d.ts +224 -0
- package/src/core/math/hash/xxh3_common.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_common.js +476 -0
- package/src/core/math/lookup/ParameterLookupTable.js +2 -2
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
- package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
- package/src/engine/asset/AssetDescription.js +2 -2
- package/src/engine/ecs/animation/Animation.js +2 -2
- package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
- package/src/engine/ecs/animation/AnimationClip.js +7 -5
- package/src/engine/ecs/gui/GUIElement.d.ts.map +1 -1
- package/src/engine/ecs/gui/GUIElement.js +7 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +11 -7
- package/src/engine/ecs/transform/Transform64.d.ts +1 -1
- package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform64.js +5 -4
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +8 -5
- package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +8 -5
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +9 -8
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +9 -6
- package/src/engine/graphics3/ParticipatingMedia.js +204 -204
- package/src/engine/graphics3/animation/AnimationClips.d.ts +5 -0
- package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -1
- package/src/engine/graphics3/animation/AnimationClips.js +5 -0
- package/src/engine/grid/obstacle/GridObstacle.js +2 -2
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
- package/src/engine/interpolation/Interpolated.js +2 -2
- package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothCollider.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothDynamics.js +20 -11
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +7 -5
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidComponent.js +19 -11
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +2 -2
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +2 -2
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +16 -9
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitter.js +12 -7
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.js +192 -191
- package/src/engine/sound/simulation/core/AcousticMedium.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticDirectivity.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticMaterial.d.ts.map +1 -1
- package/src/engine/sound/simulation/definition/AcousticMaterial.js +11 -7
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/BusDefinition.js +5 -4
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/DuckingRule.js +7 -5
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescription.js +23 -13
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +2 -2
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +7 -5
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +4 -3
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +3 -3
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +16 -9
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +7 -5
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +8 -5
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +2 -2
- package/src/engine/sound/sopra/legacy/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundEmitter.js +357 -352
- package/src/engine/sound/sopra/legacy/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundTrack.js +281 -278
- package/src/format/image/png/PNGReader.js +644 -644
- package/src/format/image/png/crc32.d.ts +1 -1
- package/src/format/image/png/crc32.js +7 -8
- package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.d.ts.map +1 -1
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +12 -8
- package/src/shade/descriptor/binding/StorageTextureBindingLayout.js +2 -2
- package/src/shade/descriptor/binding/TextureBindingLayout.js +2 -2
- package/src/shade/descriptor/blend/BlendComponent.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/ProgrammableStage.js +2 -2
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/render/ColorTargetState.js +2 -2
- package/src/shade/descriptor/pipeline/render/FragmentState.js +2 -2
- package/src/shade/descriptor/pipeline/render/PrimitiveState.js +2 -2
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +8 -5
- package/src/shade/descriptor/pipeline/render/VertexAttribute.js +2 -2
- package/src/shade/descriptor/texture/SamplerDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/SamplerDescriptor.js +20 -12
- package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/TextureDescriptor.js +11 -7
- package/src/shade/device/graph/BufferResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/BufferResourceDescriptor.js +196 -193
- package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/TextureResourceDescriptor.js +178 -173
- package/src/shade/device/timing/profile/sgpt_read_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_read_records.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_record.js +1 -1
- package/src/shade/renderer/binding/BufferBinding.js +2 -2
- package/src/shade/renderer/camera/Camera.js +2 -2
- package/src/shade/renderer/geometry/Attribute.js +2 -2
- package/src/shade/renderer/geometry/Geometry.js +2 -2
- package/src/shade/renderer/geometry/geometry_deduplicate_vertices.js +2 -2
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +2 -2
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +13 -13
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_directory_block_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +25 -25
- package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.js +13 -8
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map +1 -1
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js +14 -5
- package/src/shade/renderer/scene/optimization/sampler2d_from_image_bitmap.js +1 -1
- package/src/shade/renderer/shader/type/WGSLStructField.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUArray.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/WebGPUStruct.js +9 -6
- package/src/shade/renderer/texture/ShadeTexture.d.ts.map +1 -1
- package/src/shade/renderer/texture/ShadeTexture.js +17 -10
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +2 -2
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -4
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +6 -6
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +46 -55
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +3 -3
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +14 -4
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +10 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +82 -40
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +4 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +8 -4
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +98 -86
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +440 -298
- package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
- package/src/view/common/HTMLElementCacheKey.js +4 -3
- package/src/view/minimap/MinimapMarker.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xxh3_64.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/hash/xxh3_64.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xxh3_64.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/hash/xxh3_64.js"],"names":[],"mappings":""}
|
|
@@ -1,241 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
mul64,
|
|
6
|
-
read_u32,
|
|
7
|
-
read_u64,
|
|
8
|
-
sub64,
|
|
9
|
-
swap32,
|
|
10
|
-
swap64,
|
|
11
|
-
u64,
|
|
12
|
-
XXH3_MIDSIZE_LASTOFFSET,
|
|
13
|
-
XXH3_MIDSIZE_MAX,
|
|
14
|
-
XXH3_MIDSIZE_STARTOFFSET,
|
|
15
|
-
XXH3_SECRET_SIZE_MIN,
|
|
16
|
-
xxh3_assert_arguments,
|
|
17
|
-
xxh3_avalanche,
|
|
18
|
-
xxh3_hash_long_loop,
|
|
19
|
-
xxh3_init_acc,
|
|
20
|
-
xxh3_long_secret,
|
|
21
|
-
xxh3_merge_accs,
|
|
22
|
-
xxh3_mix16b,
|
|
23
|
-
xxh3_rrmxmx,
|
|
24
|
-
XXH_PRIME64_1,
|
|
25
|
-
XXH_SECRET_MERGEACCS_START,
|
|
26
|
-
xxh64_avalanche,
|
|
27
|
-
} from "./xxh3_common.js";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* xxHash3, 64-bit output.
|
|
31
|
-
*
|
|
32
|
-
* A direct transcription of the reference implementation, verified against its published sanity
|
|
33
|
-
* vectors — see `xxh3_64.spec.js`. Same bytes and same seed always produce the same value, on every
|
|
34
|
-
* platform, which is what makes it usable as a content address.
|
|
35
|
-
*
|
|
36
|
-
* @see https://github.com/Cyan4973/xxHash
|
|
37
|
-
*
|
|
38
|
-
* @author Alex Goldring
|
|
39
|
-
* @copyright Company Named Limited (c) 2026
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @param {Uint8Array} input 1..3 bytes
|
|
44
|
-
* @param {Uint8Array} secret
|
|
45
|
-
* @param {bigint} seed
|
|
46
|
-
* @returns {bigint}
|
|
47
|
-
*/
|
|
48
|
-
function len_1to3(input, secret, seed) {
|
|
49
|
-
const len = input.length;
|
|
50
|
-
|
|
51
|
-
const c1 = input[0];
|
|
52
|
-
const c2 = input[len >> 1];
|
|
53
|
-
const c3 = input[len - 1];
|
|
54
|
-
|
|
55
|
-
const combined = BigInt(
|
|
56
|
-
(((c1 << 16) | (c2 << 24) | c3 | (len << 8)) >>> 0)
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const bitflip = add64(read_u32(secret, 0) ^ read_u32(secret, 4), seed);
|
|
60
|
-
|
|
61
|
-
return xxh64_avalanche(combined ^ bitflip);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @param {Uint8Array} input 4..8 bytes
|
|
66
|
-
* @param {Uint8Array} secret
|
|
67
|
-
* @param {bigint} seed
|
|
68
|
-
* @returns {bigint}
|
|
69
|
-
*/
|
|
70
|
-
function len_4to8(input, secret, seed) {
|
|
71
|
-
const len = input.length;
|
|
72
|
-
|
|
73
|
-
const mixed_seed = seed ^ u64(swap32(seed) << 32n);
|
|
74
|
-
|
|
75
|
-
const input1 = read_u32(input, 0);
|
|
76
|
-
const input2 = read_u32(input, len - 4);
|
|
77
|
-
|
|
78
|
-
const bitflip = sub64(read_u64(secret, 8) ^ read_u64(secret, 16), mixed_seed);
|
|
79
|
-
const input64 = add64(input2, input1 << 32n);
|
|
80
|
-
|
|
81
|
-
return xxh3_rrmxmx(input64 ^ bitflip, len);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @param {Uint8Array} input 9..16 bytes
|
|
86
|
-
* @param {Uint8Array} secret
|
|
87
|
-
* @param {bigint} seed
|
|
88
|
-
* @returns {bigint}
|
|
89
|
-
*/
|
|
90
|
-
function len_9to16(input, secret, seed) {
|
|
91
|
-
const len = input.length;
|
|
92
|
-
|
|
93
|
-
const bitflip1 = add64(read_u64(secret, 24) ^ read_u64(secret, 32), seed);
|
|
94
|
-
const bitflip2 = sub64(read_u64(secret, 40) ^ read_u64(secret, 48), seed);
|
|
95
|
-
|
|
96
|
-
const input_lo = read_u64(input, 0) ^ bitflip1;
|
|
97
|
-
const input_hi = read_u64(input, len - 8) ^ bitflip2;
|
|
98
|
-
|
|
99
|
-
const acc = add64(
|
|
100
|
-
add64(BigInt(len), add64(swap64(input_lo), input_hi)),
|
|
101
|
-
mul128_fold64(input_lo, input_hi)
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
return xxh3_avalanche(acc);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @param {Uint8Array} input 0..16 bytes
|
|
109
|
-
* @param {Uint8Array} secret
|
|
110
|
-
* @param {bigint} seed
|
|
111
|
-
* @returns {bigint}
|
|
112
|
-
*/
|
|
113
|
-
function len_0to16(input, secret, seed) {
|
|
114
|
-
const len = input.length;
|
|
115
|
-
|
|
116
|
-
if (len > 8) {
|
|
117
|
-
return len_9to16(input, secret, seed);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (len >= 4) {
|
|
121
|
-
return len_4to8(input, secret, seed);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (len > 0) {
|
|
125
|
-
return len_1to3(input, secret, seed);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return xxh64_avalanche(seed ^ (read_u64(secret, 56) ^ read_u64(secret, 64)));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* @param {Uint8Array} input 17..128 bytes
|
|
133
|
-
* @param {Uint8Array} secret
|
|
134
|
-
* @param {bigint} seed
|
|
135
|
-
* @returns {bigint}
|
|
136
|
-
*/
|
|
137
|
-
function len_17to128(input, secret, seed) {
|
|
138
|
-
const len = input.length;
|
|
139
|
-
|
|
140
|
-
let acc = mul64(BigInt(len), XXH_PRIME64_1);
|
|
141
|
-
|
|
142
|
-
if (len > 32) {
|
|
143
|
-
if (len > 64) {
|
|
144
|
-
if (len > 96) {
|
|
145
|
-
acc = add64(acc, xxh3_mix16b(input, 48, secret, 96, seed));
|
|
146
|
-
acc = add64(acc, xxh3_mix16b(input, len - 64, secret, 112, seed));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
acc = add64(acc, xxh3_mix16b(input, 32, secret, 64, seed));
|
|
150
|
-
acc = add64(acc, xxh3_mix16b(input, len - 48, secret, 80, seed));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
acc = add64(acc, xxh3_mix16b(input, 16, secret, 32, seed));
|
|
154
|
-
acc = add64(acc, xxh3_mix16b(input, len - 32, secret, 48, seed));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
acc = add64(acc, xxh3_mix16b(input, 0, secret, 0, seed));
|
|
158
|
-
acc = add64(acc, xxh3_mix16b(input, len - 16, secret, 16, seed));
|
|
159
|
-
|
|
160
|
-
return xxh3_avalanche(acc);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @param {Uint8Array} input 129..240 bytes
|
|
165
|
-
* @param {Uint8Array} secret
|
|
166
|
-
* @param {bigint} seed
|
|
167
|
-
* @returns {bigint}
|
|
168
|
-
*/
|
|
169
|
-
function len_129to240(input, secret, seed) {
|
|
170
|
-
const len = input.length;
|
|
171
|
-
|
|
172
|
-
let acc = mul64(BigInt(len), XXH_PRIME64_1);
|
|
173
|
-
|
|
174
|
-
const round_count = (len / 16) | 0;
|
|
175
|
-
|
|
176
|
-
for (let i = 0; i < 8; i++) {
|
|
177
|
-
acc = add64(acc, xxh3_mix16b(input, 16 * i, secret, 16 * i, seed));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
let acc_end = xxh3_mix16b(
|
|
181
|
-
input, len - 16,
|
|
182
|
-
secret, XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET,
|
|
183
|
-
seed
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
acc = xxh3_avalanche(acc);
|
|
187
|
-
|
|
188
|
-
for (let i = 8; i < round_count; i++) {
|
|
189
|
-
acc_end = add64(acc_end, xxh3_mix16b(
|
|
190
|
-
input, 16 * i,
|
|
191
|
-
secret, 16 * (i - 8) + XXH3_MIDSIZE_STARTOFFSET,
|
|
192
|
-
seed
|
|
193
|
-
));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return xxh3_avalanche(add64(acc, acc_end));
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @param {Uint8Array} input more than {@link XXH3_MIDSIZE_MAX} bytes
|
|
201
|
-
* @param {Uint8Array} secret
|
|
202
|
-
* @returns {bigint}
|
|
203
|
-
*/
|
|
204
|
-
function hash_long(input, secret) {
|
|
205
|
-
const acc = xxh3_init_acc();
|
|
206
|
-
|
|
207
|
-
xxh3_hash_long_loop(acc, input, secret);
|
|
208
|
-
|
|
209
|
-
return xxh3_merge_accs(
|
|
210
|
-
acc,
|
|
211
|
-
secret, XXH_SECRET_MERGEACCS_START,
|
|
212
|
-
mul64(BigInt(input.length), XXH_PRIME64_1)
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Hash `input` to a 64-bit value.
|
|
218
|
-
*
|
|
219
|
-
* @param {Uint8Array} input bytes to hash; an empty array is valid
|
|
220
|
-
* @param {bigint} [seed] alters the whole hash; 0 selects the reference's unseeded behaviour
|
|
221
|
-
* @returns {bigint} in `[0, 2^64)`
|
|
222
|
-
*/
|
|
223
|
-
export function xxh3_64(input, seed = 0n) {
|
|
224
|
-
xxh3_assert_arguments(input, seed);
|
|
225
|
-
|
|
226
|
-
const len = input.length;
|
|
227
|
-
|
|
228
|
-
if (len <= 16) {
|
|
229
|
-
return len_0to16(input, XXH3_SECRET, seed);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (len <= 128) {
|
|
233
|
-
return len_17to128(input, XXH3_SECRET, seed);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (len <= XXH3_MIDSIZE_MAX) {
|
|
237
|
-
return len_129to240(input, XXH3_SECRET, seed);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return hash_long(input, xxh3_long_secret(seed));
|
|
241
|
-
}
|
|
1
|
+
export {
|
|
2
|
+
/** @deprecated moved to core/math/hash/xxh3_64.js; import it from there */
|
|
3
|
+
xxh3_64
|
|
4
|
+
} from "../../math/hash/xxh3_64.js";
|
|
@@ -1,224 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Truncate to 64 bits.
|
|
3
|
-
* @param {bigint} v
|
|
4
|
-
* @returns {bigint}
|
|
5
|
-
*/
|
|
6
|
-
export function u64(v: bigint): bigint;
|
|
7
|
-
/**
|
|
8
|
-
* @param {bigint} a
|
|
9
|
-
* @param {bigint} b
|
|
10
|
-
* @returns {bigint}
|
|
11
|
-
*/
|
|
12
|
-
export function mul64(a: bigint, b: bigint): bigint;
|
|
13
|
-
/**
|
|
14
|
-
* @param {bigint} a
|
|
15
|
-
* @param {bigint} b
|
|
16
|
-
* @returns {bigint}
|
|
17
|
-
*/
|
|
18
|
-
export function add64(a: bigint, b: bigint): bigint;
|
|
19
|
-
/**
|
|
20
|
-
* Two's-complement 64-bit subtraction.
|
|
21
|
-
* @param {bigint} a
|
|
22
|
-
* @param {bigint} b
|
|
23
|
-
* @returns {bigint}
|
|
24
|
-
*/
|
|
25
|
-
export function sub64(a: bigint, b: bigint): bigint;
|
|
26
|
-
/**
|
|
27
|
-
* @param {bigint} v
|
|
28
|
-
* @param {number} bits
|
|
29
|
-
* @returns {bigint}
|
|
30
|
-
*/
|
|
31
|
-
export function rotl64(v: bigint, bits: number): bigint;
|
|
32
|
-
/**
|
|
33
|
-
* Rotate within 32 bits, as the reference's `XXH_rotl32`.
|
|
34
|
-
* @param {bigint} v
|
|
35
|
-
* @param {number} bits
|
|
36
|
-
* @returns {bigint}
|
|
37
|
-
*/
|
|
38
|
-
export function rotl32(v: bigint, bits: number): bigint;
|
|
39
|
-
/**
|
|
40
|
-
* @param {bigint} v
|
|
41
|
-
* @param {number} bits
|
|
42
|
-
* @returns {bigint}
|
|
43
|
-
*/
|
|
44
|
-
export function xorshift64(v: bigint, bits: number): bigint;
|
|
45
|
-
/**
|
|
46
|
-
* Byte-reverse a 32-bit value, as the reference's `XXH_swap32`.
|
|
47
|
-
* @param {bigint} v
|
|
48
|
-
* @returns {bigint}
|
|
49
|
-
*/
|
|
50
|
-
export function swap32(v: bigint): bigint;
|
|
51
|
-
/**
|
|
52
|
-
* Byte-reverse a 64-bit value, as the reference's `XXH_swap64`.
|
|
53
|
-
* @param {bigint} v
|
|
54
|
-
* @returns {bigint}
|
|
55
|
-
*/
|
|
56
|
-
export function swap64(v: bigint): bigint;
|
|
57
|
-
/**
|
|
58
|
-
* Widening 32x32 -> 64 multiply of the low halves of both operands, as the reference's
|
|
59
|
-
* `XXH_mult32to64`.
|
|
60
|
-
*
|
|
61
|
-
* @param {bigint} a
|
|
62
|
-
* @param {bigint} b
|
|
63
|
-
* @returns {bigint}
|
|
64
|
-
*/
|
|
65
|
-
export function mult32to64(a: bigint, b: bigint): bigint;
|
|
66
|
-
/**
|
|
67
|
-
* 64x64 -> 128 multiply, folded down by XOR of the two halves.
|
|
68
|
-
*
|
|
69
|
-
* @param {bigint} a
|
|
70
|
-
* @param {bigint} b
|
|
71
|
-
* @returns {bigint}
|
|
72
|
-
*/
|
|
73
|
-
export function mul128_fold64(a: bigint, b: bigint): bigint;
|
|
74
|
-
/**
|
|
75
|
-
* The fast finalizing mix, for input whose bits are already partially mixed.
|
|
76
|
-
* @param {bigint} h64
|
|
77
|
-
* @returns {bigint}
|
|
78
|
-
*/
|
|
79
|
-
export function xxh3_avalanche(h64: bigint): bigint;
|
|
80
|
-
/**
|
|
81
|
-
* The stronger finalizing mix (after Pelle Evensen's rrmxmx), for input that has not been mixed yet.
|
|
82
|
-
* @param {bigint} h64
|
|
83
|
-
* @param {number} len
|
|
84
|
-
* @returns {bigint}
|
|
85
|
-
*/
|
|
86
|
-
export function xxh3_rrmxmx(h64: bigint, len: number): bigint;
|
|
87
|
-
/**
|
|
88
|
-
* XXH64's finalizing mix, which XXH3 reuses for its shortest inputs.
|
|
89
|
-
* @param {bigint} hash
|
|
90
|
-
* @returns {bigint}
|
|
91
|
-
*/
|
|
92
|
-
export function xxh64_avalanche(hash: bigint): bigint;
|
|
93
|
-
/**
|
|
94
|
-
* Read a little-endian u32 at `offset`.
|
|
95
|
-
*
|
|
96
|
-
* @param {Uint8Array} bytes
|
|
97
|
-
* @param {number} offset
|
|
98
|
-
* @returns {bigint}
|
|
99
|
-
*/
|
|
100
|
-
export function read_u32(bytes: Uint8Array, offset: number): bigint;
|
|
101
|
-
/**
|
|
102
|
-
* Read a little-endian u64 at `offset`.
|
|
103
|
-
*
|
|
104
|
-
* @param {Uint8Array} bytes
|
|
105
|
-
* @param {number} offset
|
|
106
|
-
* @returns {bigint}
|
|
107
|
-
*/
|
|
108
|
-
export function read_u64(bytes: Uint8Array, offset: number): bigint;
|
|
109
|
-
/**
|
|
110
|
-
* Write a little-endian u64 at `offset`.
|
|
111
|
-
*
|
|
112
|
-
* @param {Uint8Array} bytes
|
|
113
|
-
* @param {number} offset
|
|
114
|
-
* @param {bigint} value
|
|
115
|
-
*/
|
|
116
|
-
export function write_u64(bytes: Uint8Array, offset: number, value: bigint): void;
|
|
117
|
-
/**
|
|
118
|
-
* The 16-byte mixing step shared by every mid-size path.
|
|
119
|
-
*
|
|
120
|
-
* @param {Uint8Array} input
|
|
121
|
-
* @param {number} input_offset
|
|
122
|
-
* @param {Uint8Array} secret
|
|
123
|
-
* @param {number} secret_offset
|
|
124
|
-
* @param {bigint} seed
|
|
125
|
-
* @returns {bigint}
|
|
126
|
-
*/
|
|
127
|
-
export function xxh3_mix16b(input: Uint8Array, input_offset: number, secret: Uint8Array, secret_offset: number, seed: bigint): bigint;
|
|
128
|
-
/**
|
|
129
|
-
* Derive a 192-byte secret from `seed`, as the reference's `XXH3_initCustomSecret`. This is what
|
|
130
|
-
* makes a seeded hash of a long input differ from the unseeded one.
|
|
131
|
-
*
|
|
132
|
-
* @param {bigint} seed
|
|
133
|
-
* @returns {Uint8Array} freshly allocated, {@link XXH3_SECRET}'s length
|
|
134
|
-
*/
|
|
135
|
-
export function xxh3_init_custom_secret(seed: bigint): Uint8Array;
|
|
136
|
-
/**
|
|
137
|
-
* Run the whole long-input accumulator loop: whole blocks with a scramble after each, then the
|
|
138
|
-
* trailing partial block, then the (possibly overlapping) final stripe.
|
|
139
|
-
*
|
|
140
|
-
* @param {BigUint64Array} acc
|
|
141
|
-
* @param {Uint8Array} input
|
|
142
|
-
* @param {Uint8Array} secret
|
|
143
|
-
*/
|
|
144
|
-
export function xxh3_hash_long_loop(acc: BigUint64Array, input: Uint8Array, secret: Uint8Array): void;
|
|
145
|
-
/**
|
|
146
|
-
* Fold the eight lanes down to one 64-bit value.
|
|
147
|
-
*
|
|
148
|
-
* @param {BigUint64Array} acc
|
|
149
|
-
* @param {Uint8Array} secret
|
|
150
|
-
* @param {number} secret_offset
|
|
151
|
-
* @param {bigint} start
|
|
152
|
-
* @returns {bigint}
|
|
153
|
-
*/
|
|
154
|
-
export function xxh3_merge_accs(acc: BigUint64Array, secret: Uint8Array, secret_offset: number, start: bigint): bigint;
|
|
155
|
-
/**
|
|
156
|
-
* The accumulator lanes' initial state.
|
|
157
|
-
* @returns {BigUint64Array} freshly allocated, {@link XXH_ACC_NB} lanes
|
|
158
|
-
*/
|
|
159
|
-
export function xxh3_init_acc(): BigUint64Array;
|
|
160
|
-
/**
|
|
161
|
-
* The secret a seeded hash of a long input runs against: the default one for seed 0, a derived one
|
|
162
|
-
* otherwise. Shared by both variants so they agree on the seed-0 shortcut.
|
|
163
|
-
*
|
|
164
|
-
* @param {bigint} seed
|
|
165
|
-
* @returns {Uint8Array}
|
|
166
|
-
*/
|
|
167
|
-
export function xxh3_long_secret(seed: bigint): Uint8Array;
|
|
168
|
-
/**
|
|
169
|
-
* Common argument checks for the public entry points.
|
|
170
|
-
*
|
|
171
|
-
* @param {Uint8Array} input
|
|
172
|
-
* @param {bigint} seed
|
|
173
|
-
*/
|
|
174
|
-
export function xxh3_assert_arguments(input: Uint8Array, seed: bigint): void;
|
|
175
|
-
/**
|
|
176
|
-
* The pieces of xxHash3 that the 64-bit and 128-bit variants share: the primes, the mixing stages,
|
|
177
|
-
* and the long-input accumulator loop. Everything here is a direct transcription of the reference
|
|
178
|
-
* implementation's scalar path — the vectorized paths produce identical results by construction, so
|
|
179
|
-
* the scalar one is the whole specification.
|
|
180
|
-
*
|
|
181
|
-
* Arithmetic is `BigInt` masked to 64 bits after every operation. This is a build-time hash (asset
|
|
182
|
-
* identity, container checksums), never a per-frame one, so clarity against the reference wins over
|
|
183
|
-
* the 32-bit-lane decomposition a runtime implementation would need.
|
|
184
|
-
*
|
|
185
|
-
* @see https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h
|
|
186
|
-
*
|
|
187
|
-
* @author Alex Goldring
|
|
188
|
-
* @copyright Company Named Limited (c) 2026
|
|
189
|
-
*/
|
|
190
|
-
/**
|
|
191
|
-
* @readonly
|
|
192
|
-
* @type {bigint}
|
|
193
|
-
*/
|
|
194
|
-
export const XXH_MASK_64: bigint;
|
|
195
|
-
export const XXH_PRIME32_1: 2654435761n;
|
|
196
|
-
export const XXH_PRIME32_2: 2246822519n;
|
|
197
|
-
export const XXH_PRIME32_3: 3266489917n;
|
|
198
|
-
export const XXH_PRIME64_1: 11400714785074694791n;
|
|
199
|
-
export const XXH_PRIME64_2: 14029467366897019727n;
|
|
200
|
-
export const XXH_PRIME64_3: 1609587929392839161n;
|
|
201
|
-
export const XXH_PRIME64_4: 9650029242287828579n;
|
|
202
|
-
export const XXH_PRIME64_5: 2870177450012600261n;
|
|
203
|
-
export const XXH_PRIME_MX1: 1609587791953885689n;
|
|
204
|
-
export const XXH_PRIME_MX2: 11507291218515648293n;
|
|
205
|
-
/**
|
|
206
|
-
* Shortest secret any variant accepts, and the anchor for the mid-size tail offsets.
|
|
207
|
-
* @readonly
|
|
208
|
-
* @type {number}
|
|
209
|
-
*/
|
|
210
|
-
export const XXH3_SECRET_SIZE_MIN: number;
|
|
211
|
-
/**
|
|
212
|
-
* Longest input still handled by the "mid size" single-shot paths.
|
|
213
|
-
* @readonly
|
|
214
|
-
* @type {number}
|
|
215
|
-
*/
|
|
216
|
-
export const XXH3_MIDSIZE_MAX: number;
|
|
217
|
-
export const XXH3_MIDSIZE_STARTOFFSET: 3;
|
|
218
|
-
export const XXH3_MIDSIZE_LASTOFFSET: 17;
|
|
219
|
-
export const XXH_STRIPE_LEN: 64;
|
|
220
|
-
export const XXH_SECRET_CONSUME_RATE: 8;
|
|
221
|
-
export const XXH_ACC_NB: 8;
|
|
222
|
-
export const XXH_SECRET_LASTACC_START: 7;
|
|
223
|
-
export const XXH_SECRET_MERGEACCS_START: 11;
|
|
1
|
+
export { XXH_MASK_64, XXH_PRIME32_1, XXH_PRIME32_2, XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, XXH_PRIME64_4, XXH_PRIME64_5, XXH_PRIME_MX1, XXH_PRIME_MX2, XXH3_SECRET_SIZE_MIN, XXH3_MIDSIZE_MAX, XXH3_MIDSIZE_STARTOFFSET, XXH3_MIDSIZE_LASTOFFSET, XXH_STRIPE_LEN, XXH_SECRET_CONSUME_RATE, XXH_ACC_NB, XXH_SECRET_LASTACC_START, XXH_SECRET_MERGEACCS_START, u64, mul64, add64, sub64, rotl64, rotl32, xorshift64, swap32, swap64, mult32to64, mul128_fold64, xxh3_avalanche, xxh3_rrmxmx, xxh64_avalanche, read_u32, read_u64, write_u64, xxh3_mix16b, xxh3_init_custom_secret, xxh3_hash_long_loop, xxh3_merge_accs, xxh3_init_acc, xxh3_long_secret, xxh3_assert_arguments } from "../../math/hash/xxh3_common.js";
|
|
224
2
|
//# sourceMappingURL=xxh3_common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xxh3_common.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/hash/xxh3_common.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xxh3_common.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/hash/xxh3_common.js"],"names":[],"mappings":""}
|