c_cpp Ledger SDK解包Big / Little-Endian 8字节Uint64

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp Ledger SDK解包Big / Little-Endian 8字节Uint64相关的知识,希望对你有一定的参考价值。

/*******************************************************************************
*   Ark Wallet
*   (c) 2017 Ledger
*   (c) ARK Ecosystem
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
********************************************************************************/

#ifndef ARK_LEDGER_UNPACK_H
#define ARK_LEDGER_UNPACK_H

#include <os.h>

//////////////////////////////////////////////////////////////////////

#define U8BE(buf, off) (((uint64_t)(U4BE(buf, off)                      & 0xFFFFFFFF) << 32U)   |   \
                        ((uint64_t)(U4BE(buf, off + sizeof(uint32_t)))  & 0xFFFFFFFF))

#define U8LE(buf, off) (((uint64_t)(U4LE(buf, off))                     & 0xFFFFFFFF)           |   \
                        ((uint64_t)(U4LE(buf, off + sizeof(uint32_t))   & 0xFFFFFFFF) << 32U))

//////////////////////////////////////////////////////////////////////

#endif

以上是关于c_cpp Ledger SDK解包Big / Little-Endian 8字节Uint64的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp Big / Little Endian解压缩整数

如何将 4 字节的二进制数据解包为 3 字节和 1 字节的值?

向 Firebird SQL 查询中的列添加小计

类型与运算

c_cpp 为Kinect SDK v2正文数据序列化Boost.Serialization(XML)的定义

为啥 Visual Studio 2010 不“解包”系统变量?