---
title: "pack2x16snorm / packSnorm2x16: WGSL and GLSL function guide"
description: "Normalized packing maps a bounded floating-point interval onto integer fields. Use it to reduce storage or bandwidth when the reduced precision is acceptable."
url: https://typeshade.dev/reference/functions/pack2x16snorm/
language: en
---

# `pack2x16snorm`

Function

Normalized packing maps a bounded floating-point interval onto integer fields.

**Related names in other languages**

These related operations can differ in arguments, support, and semantics. The foreign names are not accepted TypeShade aliases. Check the target forms and restrictions.

- GLSL: `packSnorm2x16`

[Targets](https://typeshade.dev/reference/functions/pack2x16snorm/#targets)

## Compare examples

Compare the components, hexadecimal word, and recovered values. Notice which component occupies the low field.

**Example 1`pack2x16snorm(vec2(-1, 1))`**

`-1` `1`

Components in this example

**Result**

`0x7fff8001`

Word in binary: `2147450881`

**Example 2`pack2x16snorm(vec2(0, 0))`**

`0` `0`

Components in this example

**Result**

`0x00000000`

Word in binary: `0`

**Example 3`pack2x16snorm(vec2(0.25, 0.25))`**

`0.25` `0.25`

Components in this example

**Result**

`0x20002000`

Word in binary: `536879104`

The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

## When to use it

Use it to reduce storage or bandwidth when the reduced precision is acceptable.

## Inputs and limits

Packing clamps to the normalized interval and quantizes values. Unpacking approximates the original value; the low field belongs to the first component.

For shader input rules and precision, consult [WGSL](https://www.w3.org/TR/WGSL/) and [GLSL ES 3.00](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf).

## Related functions

- [`unpack2x16snorm`](https://typeshade.dev/reference/functions/unpack2x16snorm/)
- [`bitcast`](https://typeshade.dev/reference/functions/bitcast/)

**WGSL**

`pack2x16snorm(a)`

**GLSL ES 3.00**

`packSnorm2x16(a)`

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

Packs a `vec2` of values in \[-1, 1\] into two signed 16-bit halves of a `u32`, component 0 in the low 16 bits.

## Syntax

```ts
declare function pack2x16snorm(a0: vec2): u32
declare function pack2x16snorm(e: vec2): u32
```

## Parameters

- `e` `vec2`

## Return value

`u32`

## Description

`packSnorm2x16` on GLSL ES 3.00.

## Targets

**WGSL**

`pack2x16snorm(a)`

**GLSL ES 3.00**

`packSnorm2x16(a)`

## Examples

- [`gallery/packing-bitcast/packing-bitcast.shade.ts`](https://typeshade.dev/guide/examples/packing-bitcast/)

## See also

- [Functions](https://typeshade.dev/reference/functions/)
- [Builtin table](https://typeshade.dev/guide/language/builtins/#packing)
- [`pack2x16snorm()` in `typeshade/core/ir`](https://typeshade.dev/api/pack2x16snorm/)
