mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-07 16:48:15 +08:00
coverty
This commit is contained in:
parent
a761c9765a
commit
7473bebdbd
1 changed files with 18 additions and 6 deletions
|
@ -161,27 +161,39 @@ uint64_t bytes_to_num(uint8_t *src, size_t len) {
|
|||
}
|
||||
|
||||
uint16_t MemLeToUint2byte(const uint8_t *data) {
|
||||
return (data[1] << 8) + data[0];
|
||||
return (uint16_t)(
|
||||
(data[1] << 8) + data[0]
|
||||
);
|
||||
}
|
||||
|
||||
uint32_t MemLeToUint3byte(const uint8_t *data) {
|
||||
return (data[2] << 16) + (data[1] << 8) + data[0];
|
||||
return (uint32_t)(
|
||||
(data[2] << 16) + (data[1] << 8) + data[0]
|
||||
);
|
||||
}
|
||||
|
||||
uint32_t MemLeToUint4byte(const uint8_t *data) {
|
||||
return (data[3] << 24) + (data[2] << 16) + (data[1] << 8) + data[0];
|
||||
return (uint32_t)(
|
||||
(data[3] << 24) + (data[2] << 16) + (data[1] << 8) + data[0]
|
||||
);
|
||||
}
|
||||
|
||||
uint16_t MemBeToUint2byte(const uint8_t *data) {
|
||||
return (data[0] << 8) + data[1];
|
||||
return (uint16_t)(
|
||||
(data[0] << 8) + data[1]
|
||||
);
|
||||
}
|
||||
|
||||
uint32_t MemBeToUint3byte(const uint8_t *data) {
|
||||
return (data[0] << 16) + (data[1] << 8) + data[2];
|
||||
return (uint32_t)(
|
||||
(data[0] << 16) + (data[1] << 8) + data[2]
|
||||
);
|
||||
}
|
||||
|
||||
uint32_t MemBeToUint4byte(const uint8_t *data) {
|
||||
return (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3];
|
||||
return (uint32_t)(
|
||||
(data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]
|
||||
);
|
||||
}
|
||||
|
||||
void Uint2byteToMemLe(uint8_t *data, uint16_t value) {
|
||||
|
|
Loading…
Reference in a new issue