FastLED 3.6.0
Loading...
Searching...
No Matches
bitswap.h File Reference

Detailed Description

Functions for doing a rotation of bits/bytes used by parallel output.

Definition in file bitswap.h.

#include "FastLED.h"

Go to the source code of this file.

Classes

union  just8bits
 Structure representing 8 bits of access. More...
 
struct  sub4
 Structure representing 32 bits of access. More...
 
union  bitswap_type
 Union containing a full 8 bytes to swap the bit orientation on. More...
 

Macros

#define SWAPSA(X, N)
 Set out.X bits 0, 1, 2, and 3 to bit N of in.a.a, in.a.b, in.a.b, in.a.c, and in.a.d
 
#define SWAPSB(X, N)
 Set out.X bits 0, 1, 2, and 3 to bit N of in.b.a, in.b.b, in.b.b, in.b.c, and in.b.d
 
#define SWAPS(X, N)
 Set out.X bits to bit N of both in.a and in.b in order.
 

Functions

void swapbits8 (bitswap_type in, bitswap_type &out)
 Do an 8-byte by 8-bit rotation.
 
void slowswap (unsigned char *A, unsigned char *B)
 Slow version of the 8 byte by 8 bit rotation.
 
void transpose8x1_noinline (unsigned char *A, unsigned char *B)
 Simplified form of bits rotating function.
 
void transpose8x1 (unsigned char *A, unsigned char *B)
 Simplified form of bits rotating function.
 
void transpose8x1_MSB (unsigned char *A, unsigned char *B)
 Simplified form of bits rotating function.
 
template<int m, int n>
void transpose8 (unsigned char *A, unsigned char *B)
 Templated bit-rotating function.
 

Macro Definition Documentation

◆ SWAPS

#define SWAPS (   X,
 
)
Value:
out. X ## 0 = in.a.a ## N; \
out. X ## 1 = in.a.b ## N; \
out. X ## 2 = in.a.c ## N; \
out. X ## 3 = in.a.d ## N; \
out. X ## 4 = in.b.a ## N; \
out. X ## 5 = in.b.b ## N; \
out. X ## 6 = in.b.c ## N; \
out. X ## 7 = in.b.d ## N;

Set out.X bits to bit N of both in.a and in.b in order.

Parameters
Xthe sub4 of out to set
Nthe bit of each byte to retrieve
See also
bitswap_type

Definition at line 100 of file bitswap.h.

◆ SWAPSA

#define SWAPSA (   X,
 
)
Value:
out. X ## 0 = in.a.a ## N; \
out. X ## 1 = in.a.b ## N; \
out. X ## 2 = in.a.c ## N; \
out. X ## 3 = in.a.d ## N;

Set out.X bits 0, 1, 2, and 3 to bit N of in.a.a, in.a.b, in.a.b, in.a.c, and in.a.d

Parameters
Xthe sub4 of out to set
Nthe bit of each byte to retrieve
See also
bitswap_type

Definition at line 80 of file bitswap.h.

◆ SWAPSB

#define SWAPSB (   X,
 
)
Value:
out. X ## 0 = in.b.a ## N; \
out. X ## 1 = in.b.b ## N; \
out. X ## 2 = in.b.c ## N; \
out. X ## 3 = in.b.d ## N;

Set out.X bits 0, 1, 2, and 3 to bit N of in.b.a, in.b.b, in.b.b, in.b.c, and in.b.d

Parameters
Xthe sub4 of out to set
Nthe bit of each byte to retrieve
See also
bitswap_type

Definition at line 90 of file bitswap.h.

Function Documentation

◆ slowswap()

void slowswap ( unsigned char *  A,
unsigned char *  B 
)
inline

Slow version of the 8 byte by 8 bit rotation.

Definition at line 159 of file bitswap.h.

◆ swapbits8()

void swapbits8 ( bitswap_type  in,
bitswap_type out 
)
inline

Do an 8-byte by 8-bit rotation.

Definition at line 111 of file bitswap.h.

◆ transpose8()

template<int m, int n>
void transpose8 ( unsigned char *  A,
unsigned char *  B 
)
inline

Templated bit-rotating function.

Based on code found here: https://web.archive.org/web/20190108225554/http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt

Definition at line 250 of file bitswap.h.

◆ transpose8x1()

void transpose8x1 ( unsigned char *  A,
unsigned char *  B 
)
inline

Simplified form of bits rotating function.

This rotates data into LSB for a faster write (the code using this data can happily walk the array backwards).
Based on code found here: https://web.archive.org/web/20190108225554/http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt

Definition at line 190 of file bitswap.h.

◆ transpose8x1_MSB()

void transpose8x1_MSB ( unsigned char *  A,
unsigned char *  B 
)
inline

Simplified form of bits rotating function.

Based on code found here: https://web.archive.org/web/20190108225554/http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt

Definition at line 216 of file bitswap.h.

◆ transpose8x1_noinline()

void transpose8x1_noinline ( unsigned char *  A,
unsigned char *  B 
)

Simplified form of bits rotating function.

This rotates data into LSB for a faster write (the code using this data can happily walk the array backwards).
Based on code found here: https://web.archive.org/web/20190108225554/http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt

Definition at line 9 of file bitswap.cpp.