greenplumn bitstream 源码

  • 2022-08-18
  • 浏览 (373)

greenplumn bitstream 代码

文件路径:/src/include/utils/bitstream.h

/*------------------------------------------------------------------------------
 *
 * bitstream
 *
 * A in-memory bitstream implementation.
 * Useful for reading and writing individual bits from a char buffer
 * 
 * Copyright (c) 2013-Present VMware, Inc. or its affiliates.
 *
 *
 * IDENTIFICATION
 *	    src/include/utils/bitstream.h
 *
 *------------------------------------------------------------------------------
*/
#ifndef CDB_BITSTREAM_H
#define CDB_BITSTREAM_H

/*
 * Data structure implementing a bitstream abstraction.
 *
 * A bitstream is used to read and write individual bits from a data buffer
 * conveniently. 
 */
typedef struct Bitstream
{
	/*
	 * Offset within the current byte
	 */ 
	int bitOffset;

	/*
	 * Offset to the start of the data pointer
	 */
	int byteOffset;

	/*
	 * Data buffer to read from or write to.
	 */
	unsigned char* data;

	/*
	 * Size of the data buffer.
	 * The bitstream should never read or write beyond the data size.
	 */ 
	int dataSize;

	/*
	 * Error flag.
	 */ 
	bool error;
} Bitstream;


void Bitstream_Init(Bitstream *bitstream, unsigned char* data, int dataSize);

int Bitstream_GetOffset(Bitstream *bitstream);

bool Bitstream_Get(Bitstream *bitstream, int n, uint32 *value);

bool Bitstream_Put(Bitstream *bitstream, uint32_t v, int bitCount);

bool Bitstream_HasError(Bitstream *bitstream);

bool Bitstream_Skip(Bitstream* bitstream, int skipBitCount);

bool Bitstream_Align(Bitstream *bitstream, int alignment);

unsigned char* Bitstream_GetAlignedData(Bitstream *bitstream, int alignment);

int Bitstream_GetRemaining(Bitstream *bitstream);

int Bitstream_GetLength(Bitstream *bitstream);
#endif

相关信息

greenplumn 源码目录

相关文章

greenplumn acl 源码

greenplumn aclchk_internal 源码

greenplumn array 源码

greenplumn arrayaccess 源码

greenplumn ascii 源码

greenplumn attoptcache 源码

greenplumn backend_cancel 源码

greenplumn bitmap_compression 源码

greenplumn builtins 源码

greenplumn bytea 源码

0  赞