ycd

package
v0.0.0-...-3b98f14 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const WordSize = 8

WordSize is the size of a word (64 bits / 8 bytes).

Variables

This section is empty.

Functions

func DigitsPerWord

func DigitsPerWord(radix int) int

DigitsPerWord returns the number of digits per word (64 bits).

Types

type Header struct {
	// FileVersion is the version of the ycd file.
	// Currently it's 1.1.0 and this code is tested against the version.
	FileVersion string

	// Radis is the radix of the file. 10 or 16.
	Radix int

	// FirstDigits is always the first several digits of pi?
	// e.g. 3.14159265358979323846264338327950288419716939937510 for decimal and
	// 3.243f6a8885a308d313198a2e03707344a4093822299f31d008 for hexadecimal.
	FirstDigits string

	// TotalDigits is zero if the file has n == BlockSize.
	// otherwise it's the number of digits in the file.
	TotalDigits int64

	// BlockSize is digits per file.
	BlockSize int64

	// BlockID is the position of the current file.
	BlockID int64

	// Length is the total byte length of the header in the file.
	// It is the offset of the empty line after EndHeader.
	Length int
}

type YCDFile

type YCDFile struct {
	Header           *Header
	Name             string
	FirstDigitOffset int
}

func Parse

func Parse(reader io.Reader) (*YCDFile, error)

Parse parses the header of a ycd file and returns the field values.

func (*YCDFile) BlockByteLength

func (y *YCDFile) BlockByteLength() int64

BlockByteLength returns the total byte length of the block rounding up to the word alignment.

Jump to

Keyboard shortcuts

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