livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
Loading...
Searching...
No Matches
crc.hpp File Reference

CRC algorithms defined by the Livox Mid-360 communication protocol (section "CRC Algorithm"). More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <span>

Go to the source code of this file.

Namespaces

namespace  livox
 Livox LiDAR drivers.
namespace  livox::mid360
 The livox_mid360_core library: everything declared by the public headers.
namespace  livox::mid360::crc
 CRC-16 and CRC-32 as defined by the Mid-360 communication protocol (crc.hpp).

Functions

constexpr std::uint16_t livox::mid360::crc::crc16_ccitt_false (std::span< const std::byte > data, std::uint16_t state=0xFFFF) noexcept
 Incremental CRC-16/CCITT-FALSE. Pass the previous result as state to continue.
constexpr std::uint32_t livox::mid360::crc::crc32 (std::span< const std::byte > data, std::uint32_t state=0) noexcept
 Incremental CRC-32 (zlib-compatible).

Detailed Description

CRC algorithms defined by the Livox Mid-360 communication protocol (section "CRC Algorithm").

CRC-16/CCITT-FALSE : poly 0x1021, init 0xFFFF, xorout 0x0000, refin=false, refout=false
CRC-32 : poly 0x04C11DB7, init 0xFFFFFFFF, xorout 0xFFFFFFFF, refin=true,
refout=true
(identical to the CRC-32 used by zlib / Ethernet / PNG)

Both are pure functions, usable at compile time, and have no I/O dependency.