c4e_bvec.h File Reference

(Version 579)

Binary (bit-wise) operations on digit vectors. More...

#include "c4e_sys.h"
Include dependency graph for c4e_bvec.h:

Go to the source code of this file.

Functions

void c4e_bvec_not (C4E_CONST C4eArchDigit *px, C4eArchIdx len, C4eArchDigit *py)
 Bitwise logical inversion of a digit vector.
void c4e_bvec_xor (C4E_CONST C4eArchDigit *pa, C4E_CONST C4eArchDigit *pb, C4eArchIdx len, C4eArchDigit *py)
 Bitwise logical XOR of two digit vectors (exclusive-or).
void c4e_bvec_or (C4E_CONST C4eArchDigit *pa, C4E_CONST C4eArchDigit *pb, C4eArchIdx len, C4eArchDigit *py)
 Bitwise logical OR of two digit vectors.
void c4e_bvec_and (C4E_CONST C4eArchDigit *pa, C4E_CONST C4eArchDigit *pb, C4eArchIdx len, C4eArchDigit *py)
 Bitwise logical AND of two digit vectors.
void c4e_bvec_digits_shl (C4eArchDigit *v, C4eArchIdx len, C4eArchIdx shift)
 Shift left of a digits vector by a number of digits.
C4eArchDigit c4e_bvec_bits_shl (C4eArchDigit *v, C4eArchIdx len, C4eArchUint shift)
 Shift left of a digits vector by a number of bits, less than C4E_SYS_DIGIT_BITS.
C4eArchIdx c4e_bvec_shl (C4eArchDigit *v, C4eArchIdx len, C4eArchSize shift)
 Shift left of digits vector by a number of bits.
void c4e_bvec_digits_shr (C4eArchDigit *v, C4eArchIdx len, C4eArchIdx shift)
 Shift right of a digits vector, w/o clear of most significant ones.
void c4e_bvec_bits_shr (C4eArchDigit *v, C4eArchIdx len, C4eArchUint shift)
 Shift right of a digits vector by a number of bits, less than C4E_SYS_DIGIT_BITS.
C4eArchIdx c4e_bvec_shr (C4eArchDigit *v, C4eArchIdx len, C4eArchSize shift)
 Shift right of a digits vector by a number of bits.
void c4e_bvec_rol (C4E_CONST C4eArchDigit *C4E_RESTRICT v, C4eArchIdx len, C4eArchSize shift, C4eArchDigit *C4E_RESTRICT result)
 Rotate left of a digits vector by a number of bits (wrap- around at length).
void c4e_bvec_ror (C4E_CONST C4eArchDigit *C4E_RESTRICT v, C4eArchIdx len, C4eArchSize shift, C4eArchDigit *C4E_RESTRICT result)
 Rotate right of a digits vector by a number of bits (wrap- around at length).

Detailed Description

Binary (bit-wise) operations on digit vectors.

Author:
Copyright (C) 2010, 2013, 2015 Ralf Hoppe <ralf.hoppe@ieee.org>
Version:
Id
c4e_bvec.h 579 2015-05-24 18:00:40Z ralf

Definition in file c4e_bvec.h.


Function Documentation

void c4e_bvec_not ( C4E_CONST C4eArchDigit px,
C4eArchIdx  len,
C4eArchDigit py 
)

Bitwise logical inversion of a digit vector.

Note:
It is allowed to set py pointing to px.
Precondition:
py must point to pre-allocated memory of size len * C4E_ARCH_DIGIT_SIZE.
Parameters:
[in] px Pointer to input digits vector.
[in] len Number of elements in vectors px[], py[].
[out] py Result py[] = ~ px[].
void c4e_bvec_xor ( C4E_CONST C4eArchDigit pa,
C4E_CONST C4eArchDigit pb,
C4eArchIdx  len,
C4eArchDigit py 
)

Bitwise logical XOR of two digit vectors (exclusive-or).

Note:
It is allowed to set py pointing to pa or pb (accumulator mode).
Precondition:
py must point to pre-allocated memory of size len * C4E_ARCH_DIGIT_SIZE.
Parameters:
[in] pa Pointer to first digits vector.
[in] pb Pointer to second digits vector.
[in] len Number of elements in vectors pa[], pb[] and py[].
[out] py Result of py[] = pa[] ^ pb[].
void c4e_bvec_or ( C4E_CONST C4eArchDigit pa,
C4E_CONST C4eArchDigit pb,
C4eArchIdx  len,
C4eArchDigit py 
)

Bitwise logical OR of two digit vectors.

Note:
It is allowed to set py pointing to pa or pb (accumulator mode).
Precondition:
py must point to pre-allocated memory of size len * C4E_ARCH_DIGIT_SIZE.
Parameters:
[in] pa Pointer to first digits vector.
[in] pb Pointer to second digits vector.
[in] len Number of elements in vectors pa[], pb[] and py[].
[out] py Result of py[] = pa[] | pb[].
void c4e_bvec_and ( C4E_CONST C4eArchDigit pa,
C4E_CONST C4eArchDigit pb,
C4eArchIdx  len,
C4eArchDigit py 
)

Bitwise logical AND of two digit vectors.

Note:
It is allowed to set py pointing to pa or pb (accumulator mode).
Precondition:
py must point to pre-allocated memory of size len * C4E_ARCH_DIGIT_SIZE.
Parameters:
[in] pa Pointer to first digits vector.
[in] pb Pointer to second digits vector.
[in] len Number of elements in vectors pa[], pb[] and py[].
[out] py Result of py[] = pa[] & pb[].
void c4e_bvec_digits_shl ( C4eArchDigit v,
C4eArchIdx  len,
C4eArchIdx  shift 
)

Shift left of a digits vector by a number of digits.

Precondition:
v must point to pre-allocated memory of (len + shift) digits.
Parameters:
[in,out] v Digits vector to be shifted left.
[in] len Length of digits vector v.
[in] shift The number of digits v shall be shifted left.
C4eArchDigit c4e_bvec_bits_shl ( C4eArchDigit v,
C4eArchIdx  len,
C4eArchUint  shift 
)

Shift left of a digits vector by a number of bits, less than C4E_SYS_DIGIT_BITS.

Parameters:
[in,out] v Digits vector to be shifted left.
[in] len Length of digits vector v.
[in] shift The number of bits (0 ... C4E_SYS_DIGIT_BITS-1).
Returns:
The most significant digit, which should be stored at v + len.
C4eArchIdx c4e_bvec_shl ( C4eArchDigit v,
C4eArchIdx  len,
C4eArchSize  shift 
)

Shift left of digits vector by a number of bits.

Precondition:
v must point to pre-allocated memory of (len + shift / C4E_SYS_DIGIT_BITS + 1) digits.
Parameters:
[in,out] v Digits vector to be shifted left.
[in] len Length of digits vector v.
[in] shift The number of bits v shall be shifted left.
Returns:
The increase of length associated with the shift (zero if shift is zero).
void c4e_bvec_digits_shr ( C4eArchDigit v,
C4eArchIdx  len,
C4eArchIdx  shift 
)

Shift right of a digits vector, w/o clear of most significant ones.

Parameters:
[in,out] v Digits vector to be shifted right.
[in] len Length of digits vector v.
[in] shift The number of digits v shall be shifted right.
void c4e_bvec_bits_shr ( C4eArchDigit v,
C4eArchIdx  len,
C4eArchUint  shift 
)

Shift right of a digits vector by a number of bits, less than C4E_SYS_DIGIT_BITS.

Parameters:
[in,out] v Digits vector to be shifted right.
[in] len Length of digits vector v.
[in] shift The number of bits (0 ... C4E_SYS_DIGIT_BITS-1).
See also:
c4e_bvec_digits_shr()
C4eArchIdx c4e_bvec_shr ( C4eArchDigit v,
C4eArchIdx  len,
C4eArchSize  shift 
)

Shift right of a digits vector by a number of bits.

Parameters:
[in,out] v Digits vector to be shifted right.
[in] len Length of digits vector v (before and after the shift operation).
[in] shift The number of bits v shall be shifted right.
Returns:
The decrease of length associated with the shift (zero if shift is zero).
void c4e_bvec_rol ( C4E_CONST C4eArchDigit *C4E_RESTRICT  v,
C4eArchIdx  len,
C4eArchSize  shift,
C4eArchDigit *C4E_RESTRICT  result 
)

Rotate left of a digits vector by a number of bits (wrap- around at length).

Parameters:
[in] v Digits vector to be rotated left.
[in] len Length of digits vector v and result, which must be greater than zero.
[in] shift The number of bits v shall be rotated left.
[out] result Result of rotation.
void c4e_bvec_ror ( C4E_CONST C4eArchDigit *C4E_RESTRICT  v,
C4eArchIdx  len,
C4eArchSize  shift,
C4eArchDigit *C4E_RESTRICT  result 
)

Rotate right of a digits vector by a number of bits (wrap- around at length).

Parameters:
[in] v Digits vector to be rotated right.
[in] len Length of digits vector v and result, which must be greater than zero.
[in] shift The number of bits v shall be rotated right.
[out] result Result of rotation.