The snappy Reference Manual

This is the snappy Reference Manual, version 0.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:44:11 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 snappy

An implementation of Snappy compression.

Author

Robert Brown <>

License

New BSD license. See the copyright messages in individual files.

Long Description

An implementation of Google’s Snappy compression algorithm, which is designed for speed of compression and decompression.

Version

0.3

Defsystem Dependency

com.google.base (system).

Dependencies
  • com.google.base (system).
  • nibbles (system).
  • varint (system).
Source

snappy.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 snappy/snappy.asd

Source

snappy.asd.

Parent Component

snappy (system).

ASDF Systems

snappy.


3.1.2 snappy/package.lisp

Source

snappy.asd.

Parent Component

snappy (system).

Packages

snappy.


3.1.3 snappy/snappy.lisp

Dependency

package.lisp (file).

Source

snappy.asd.

Parent Component

snappy (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 snappy

An implementation of Google’s Snappy compression algorithm, which is designed for speed of compression and decompression.

Source

package.lisp.

Use List
  • com.google.base.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: compress (buffer index limit)

Compresses the contents of BUFFER, a vector of (UNSIGNED-BYTE 8), from position INDEX to position LIMIT. Returns two values, a vector of
type (UNSIGNED-BYTE 8) holding the compressed data and an integer indicating the number of compressed octets in the vector.

Package

snappy.

Source

snappy.lisp.

Function: maximum-compressed-length (uncompressed-length)

Returns the maximum size a vector of length UNCOMPRESSED-LENGTH may take up after it is compressed.

Package

snappy.

Source

snappy.lisp.

Function: uncompress (buffer index limit)

Uncompresses BUFFER, a vector of (UNSIGNED-BYTE 8), from position INDEX to LIMIT. Returns the uncompressed data as a vector of (UNSIGNED-BYTE 8).

Package

snappy.

Source

snappy.lisp.

Function: uncompressed-length (buffer index limit)

Returns the uncompressed length of the compressed data stored in BUFFER from position INDEX to LIMIT.

Package

snappy.

Source

snappy.lisp.


5.2 Internals


5.2.1 Constants

Constant: +copy-1-byte-offset+
Package

snappy.

Source

snappy.lisp.

Constant: +copy-2-byte-offset+
Package

snappy.

Source

snappy.lisp.

Constant: +copy-4-byte-offset+
Package

snappy.

Source

snappy.lisp.

Constant: +decompression-table+

Data stored per entry in lookup table:
Range Bits-used Description ————————————
1..64 0..7 Literal/copy length encoded in opcode byte 0..7 8..10 Copy offset encoded in opcode byte / 256 0..4 11..13 Extra bytes after opcode

We use eight bits for the length even though 7 would have sufficed because of efficiency reasons:
(1) Extracting a byte is faster than a bit field
(2) It properly aligns copy offset so we do not need a <<8

Package

snappy.

Source

snappy.lisp.

Constant: +literal+
Package

snappy.

Source

snappy.lisp.

Constant: +maximum-hash-bits+
Package

snappy.

Source

snappy.lisp.

Constant: +maximum-hash-table-size+
Package

snappy.

Source

snappy.lisp.

Constant: +vector-index-bits+
Package

snappy.

Source

snappy.lisp.

Constant: +word-mask+

Mapping from i in range [0,4] to a mask to extract the bottom 8*i bits.

Package

snappy.

Source

snappy.lisp.


5.2.2 Macros

Macro: postincf (variable)
Package

snappy.

Source

snappy.lisp.


5.2.3 Ordinary functions

Function: emit-copy (output-buffer out offset length)
Package

snappy.

Source

snappy.lisp.

Function: emit-copy-less-than-64 (output-buffer out offset length)
Package

snappy.

Source

snappy.lisp.

Function: emit-literal (input-buffer literal output-buffer out length)
Package

snappy.

Source

snappy.lisp.

Function: hash (buffer index mask)
Package

snappy.

Source

snappy.lisp.

Function: raw-compress (input-buffer in in-limit output-buffer out out-limit)
Package

snappy.

Source

snappy.lisp.

Function: raw-uncompress (input-buffer in in-limit output-buffer out out-limit)
Package

snappy.

Source

snappy.lisp.


5.2.4 Types

Type: decompression-entry ()
Package

snappy.

Source

snappy.lisp.

Type: hash-result ()
Package

snappy.

Source

snappy.lisp.

Type: table-size ()
Package

snappy.

Source

snappy.lisp.


Appendix A Indexes


A.1 Concepts