Changeset View
Changeset View
Standalone View
Standalone View
src/crypto/common.h
// Copyright (c) 2014 The Bitcoin Core developers | // Copyright (c) 2014 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_CRYPTO_COMMON_H | #ifndef BITCOIN_CRYPTO_COMMON_H | ||||
#define BITCOIN_CRYPTO_COMMON_H | #define BITCOIN_CRYPTO_COMMON_H | ||||
#if defined(HAVE_CONFIG_H) | #if defined(HAVE_CONFIG_H) | ||||
#include "config/bitcoin-config.h" | #include <config/bitcoin-config.h> | ||||
#endif | #endif | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <cstring> | #include <cstring> | ||||
#include "compat/endian.h" | #include <compat/endian.h> | ||||
static inline uint16_t ReadLE16(const uint8_t *ptr) { | static inline uint16_t ReadLE16(const uint8_t *ptr) { | ||||
uint16_t x; | uint16_t x; | ||||
memcpy((char *)&x, ptr, 2); | memcpy((char *)&x, ptr, 2); | ||||
return le16toh(x); | return le16toh(x); | ||||
} | } | ||||
static inline uint32_t ReadLE32(const uint8_t *ptr) { | static inline uint32_t ReadLE32(const uint8_t *ptr) { | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |