DESERT 3.5.1
Loading...
Searching...
No Matches
packer.cpp File Reference
#include "packer.h"
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits.h>
Include dependency graph for packer.cpp:

Go to the source code of this file.

Classes

class  PackerClass
 

Macros

#define DEFAULT_DUMMY_CONTENT_LENGTH   256
 
#define BARR_ELBITS   (CHAR_BIT * sizeof(BARR_ELTYPE))
 
#define BARR_ARRAYSIZE(N)   (((N) + BARR_ELBITS - 1) / BARR_ELBITS)
 
#define BARR_ELNUM(N)   ((N) / BARR_ELBITS)
 
#define BARR_BITNUM(N)   ((N) % BARR_ELBITS)
 
#define BARR_SET(barr, N)
 
#define BARR_CLEAR(barr, N)
 
#define BARR_TEST(barr, N)
 

Typedefs

typedef unsigned char BARR_ELTYPE
 

Variables

PackerClass class_module_packer
 

Detailed Description

Header of the class responsible to map an NS-Miracle packet into a bit stream, and vice-versa.

Author
Riccardo Masiero
Version
1.0.0

Definition in file packer.cpp.

Macro Definition Documentation

◆ BARR_ARRAYSIZE

#define BARR_ARRAYSIZE (   N)    (((N) + BARR_ELBITS - 1) / BARR_ELBITS)

MACRO to compute the minimum number of elements that a buffer of BARR_ELTYPEs must have in order to store N bits.

Parameters
Nthe number of bits to store.

Definition at line 60 of file packer.cpp.

◆ BARR_BITNUM

#define BARR_BITNUM (   N)    ((N) % BARR_ELBITS)

MACRO to compute the position where is stored the bit N, within its corresponding element of a buffer of BARR_ELTYPEs .

Parameters
Nindication of the bit.

Definition at line 74 of file packer.cpp.

◆ BARR_CLEAR

#define BARR_CLEAR (   barr,
 
)
Value:
(((BARR_ELTYPE *) (barr))[BARR_ELNUM(N)] &= \
~((BARR_ELTYPE) 1 << BARR_BITNUM(N)))
unsigned char BARR_ELTYPE
Definition frame-set.cpp:43
unsigned char BARR_ELTYPE
Definition packer.cpp:45
#define BARR_ELNUM(N)
MACRO to compute the number of the element of a buffer of BARR_ELTYPEs where is stored the bit N.
Definition packer.cpp:67
#define BARR_BITNUM(N)
MACRO to compute the position where is stored the bit N, within its corresponding element of a buffer...
Definition packer.cpp:74

MACRO to set to 0 the bit N of a buffer of BARR_ELTYPEs.

Parameters
barrpointer to the buffer
Nindication of the bit.

Definition at line 90 of file packer.cpp.

◆ BARR_ELBITS

#define BARR_ELBITS   (CHAR_BIT * sizeof(BARR_ELTYPE))

The size, in bits, of a BARR_ELTYPE (unsigned char).

Used for code portability.

Definition at line 53 of file packer.cpp.

◆ BARR_ELNUM

#define BARR_ELNUM (   N)    ((N) / BARR_ELBITS)

MACRO to compute the number of the element of a buffer of BARR_ELTYPEs where is stored the bit N.

Parameters
Nindication of the bit.

Definition at line 67 of file packer.cpp.

◆ BARR_SET

#define BARR_SET (   barr,
 
)
Value:
(((BARR_ELTYPE *) (barr))[BARR_ELNUM(N)] |= (BARR_ELTYPE) 1 \
<< BARR_BITNUM(N))

MACRO to set to 1 the bit N of a buffer of BARR_ELTYPEs.

Parameters
barrpointer to the buffer
Nindication of the bit.

Definition at line 81 of file packer.cpp.

◆ BARR_TEST

#define BARR_TEST (   barr,
 
)
Value:
(((BARR_ELTYPE *) (barr))[BARR_ELNUM(N)] & \
((BARR_ELTYPE) 1 << BARR_BITNUM(N)))

MACRO to test if the bit N of a buffer of BARR_ELTYPEs is set to 1.

Parameters
barrpointer to the buffer
Nindication of the bit.

Definition at line 99 of file packer.cpp.

◆ DEFAULT_DUMMY_CONTENT_LENGTH

#define DEFAULT_DUMMY_CONTENT_LENGTH   256

Definition at line 47 of file packer.cpp.

Typedef Documentation

◆ BARR_ELTYPE

typedef unsigned char BARR_ELTYPE

Definition at line 45 of file packer.cpp.

Variable Documentation

◆ class_module_packer

PackerClass class_module_packer
static