OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
crc32_t.h
1#pragma once
2#ifndef OSCR_CRC32_T_H_
3# define OSCR_CRC32_T_H_
4
5# include "config.h"
6# include "syslibinc.h"
7
8namespace OSCR::CRC32
9{
13 typedef union crc32_t
14 {
15 // Accessors
16 uint32_t value;
17 uint8_t b[4];
18
19 // Constructors
20
24 crc32_t();
25
31 explicit crc32_t(uint32_t v);
32
34
35 // Implicit Casts
36 operator uint32_t() const;
37
38 bool operator==(crc32_t const & rhs) const;
39
40 crc32_t & operator=(uint32_t v);
41
42 crc32_t & operator+=(uint8_t data);
43 crc32_t & operator+=(uint16_t data);
44 crc32_t & operator+=(uint32_t data);
45
46 // Operators
47 uint8_t & operator[](size_t idx);
48 uint8_t const & operator[](size_t idx) const;
49
51
52 // Methods
53
54 void reset();
55 void next(uint8_t const * data);
56 void next(uint8_t data);
57 void done();
58
65 void human(char * buffer, uint_fast8_t sizeOf = 9) const;
66 } crc32_t;
67}
68
69#endif /* OSCR_CRC32_T_H_ */
Interface for handling CRC32 values.
Definition crc32_t.h:14
uint32_t value
The CRC32 (binary, host endian)
Definition crc32_t.h:16
crc32_t()
Create an empty CRC32 interface.
Definition crc32.cpp:160
uint8_t b[4]
The 4 bytes that make up the CRC32.
Definition crc32_t.h:17
void human(char *buffer, uint_fast8_t sizeOf=9) const
Definition crc32.cpp:341
crc32_t()
Create an empty CRC32 interface.
Definition crc32.cpp:160