The snappy Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

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 Thu Sep 15 06:11:07 2022 GMT+0.

Table of Contents


1 Introduction

Snappy

A Common Lisp implementation of Google's Snappy data compression library. The original name for Google's Snappy compression library was Zippy.

The Snappy API

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.

maximum-compressed-length uncompressed-length

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

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).

uncompressed-length buffer index limit

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

For more information, see the documentation strings in snappy.lisp, the example code in snappy-test.lisp, and Google's GitHub Snappy page.


2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 snappy

An implementation of Snappy compression.

Author

Robert Brown <robert.brown@gmail.com>

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.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

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.


Previous: , Up: Lisp   [Contents][Index]

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.


Previous: , Up: Packages   [Contents][Index]

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.


Next: , Previous: , Up: Definitions   [Contents][Index]

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


Next: , Previous: , Up: Internals   [Contents][Index]

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.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.2 Macros

Macro: postincf (variable)
Package

snappy.

Source

snappy.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

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


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts