codec

package
v1.2.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeU1

func DecodeU1(bytes []byte) ([]byte, uint)

DecodeU1 decodes an array of 1bit values represented in a "dense encoding". That is, where each value is stored consecutively with 8 values being packed into a single byte. The number of "unused values" is stored in an additional final byte.

func DecodeU1Dense

func DecodeU1Dense[T uint8 | uint16 | uint32](bytes []byte) []T

DecodeU1Dense decodes an array of 1bit values represented in a "dense encoding". That is, where each value is stored consecutively with 8 values being packed into a single byte. The number of "unused values" is stored in an additional final byte.

func DecodeU2Dense

func DecodeU2Dense[T uint8 | uint16 | uint32](bytes []byte) []T

DecodeU2Dense decodes an array of 2bit values represented in a "dense encoding". That is, where value is stored consecutively with 4 values being packed into a single byte. The number of "unused values" is stored in an additional final byte.

func DecodeU4Dense

func DecodeU4Dense[T uint8 | uint16 | uint32](bytes []byte) []T

DecodeU4Dense decodes an array of 2bit values represented in a "dense encoding". That is, where value is stored consecutively with 2 values being packed into a single byte. The number of "unused values" is stored in an additional final byte.

func DecodeU8Dense

func DecodeU8Dense[T uint8 | uint16 | uint32 | uint64](bytes []byte) []T

DecodeU8Dense decode an array of bytes represented in a "dense encoding". That is, where value is stored consecutively.

func DecodeU8Sparse

func DecodeU8Sparse[T uint8 | uint16 | uint32 | uint64](bytes []byte, blockSizeWidth uint) []T

DecodeU8Sparse decodes an array of bytes represented in a "sparse encoding". Specifically, data is encoded as an array of tuples (value, n) which represent n copies of the given value.

func DecodeU16Dense

func DecodeU16Dense[T uint16 | uint32 | uint64](bytes []byte) []T

DecodeU16Dense decode an array of 16bit values represented in a "dense encoding". That is, where value is stored consecutively.

func DecodeU16Sparse

func DecodeU16Sparse[T uint16 | uint32 | uint64](bytes []byte, blockSizeWidth uint) []T

DecodeU16Sparse decodes an array of 16bit values represented in a "sparse encoding". Specifically, data is encoded as an array of tuples (value, n) which represent n copies of the given value.

func DecodeU32Dense

func DecodeU32Dense[T uint32 | uint64](bytes []byte) []T

DecodeU32Dense decode an array of 32bit values represented in a "dense encoding". That is, where value is stored consecutively.

func DecodeU32Sparse

func DecodeU32Sparse[T uint32 | uint64](bytes []byte, blockSizeWidth uint) []T

DecodeU32Sparse decodes an array of 32bit values represented in a "sparse encoding". Specifically, data is encoded as an array of tuples (value, n) which represent n copies of the given value.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL