QP/C++  7.0.1
Real-Time Embedded Framework
qs_64bit.cpp
Go to the documentation of this file.
1//============================================================================
2// QP/C++ Real-Time Embedded Framework (RTEF)
3// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
4//
5// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
6//
7// This software is dual-licensed under the terms of the open source GNU
8// General Public License version 3 (or any later version), or alternatively,
9// under the terms of one of the closed source Quantum Leaps commercial
10// licenses.
11//
12// The terms of the open source GNU General Public License version 3
13// can be found at: <www.gnu.org/licenses/gpl-3.0>
14//
15// The terms of the closed source Quantum Leaps commercial licenses
16// can be found at: <www.state-machine.com/licensing>
17//
18// Redistributions in source code must retain this top-level comment block.
19// Plagiarizing this software to sidestep the license obligations is illegal.
20//
21// Contact information:
22// <www.state-machine.com>
23// <info@state-machine.com>
24//============================================================================
30
31#define QP_IMPL // this is QF/QK implementation
32#include "qs_port.hpp" // QS port
33#include "qs_pkg.hpp" // QS package-scope internal interface
34
35namespace QP {
36
37//============================================================================
41void QS::u64_raw_(std::uint64_t d) noexcept {
42 std::uint8_t chksum_ = priv_.chksum;
43 std::uint8_t * const buf_ = priv_.buf;
44 QSCtr head_ = priv_.head;
45 QSCtr const end_ = priv_.end;
46
47 priv_.used = (priv_.used + 8U); // 8 bytes are about to be added
48 for (std::int_fast8_t i = 8U; i != 0U; --i) {
49 std::uint8_t const b = static_cast<std::uint8_t>(d);
51 d >>= 8U;
52 }
53
54 priv_.head = head_; // save the head
55 priv_.chksum = chksum_; // save the checksum
56}
57
58//============================================================================
62void QS::u64_fmt_(std::uint8_t format, std::uint64_t d) noexcept {
63 std::uint8_t chksum_ = priv_.chksum;
64 std::uint8_t * const buf_ = priv_.buf;
65 QSCtr head_ = priv_.head;
66 QSCtr const end_ = priv_.end;
67
68 priv_.used = (priv_.used + 9U); // 9 bytes are about to be added
69 QS_INSERT_ESC_BYTE_(format) // insert the format byte
70
71 for (std::int_fast8_t i = 8U; i != 0U; --i) {
72 format = static_cast<std::uint8_t>(d);
74 d >>= 8U;
75 }
76
77 priv_.head = head_; // save the head
78 priv_.chksum = chksum_; // save the checksum
79}
80
81} // namespace QP
static void u64_fmt_(std::uint8_t format, std::uint64_t d) noexcept
Output uint64_t data element with format information.
Definition: qs_64bit.cpp:62
static void u64_raw_(std::uint64_t d) noexcept
Output uint64_t data element without format information.
Definition: qs_64bit.cpp:41
namespace associated with the QP/C++ framework
Definition: exa_native.dox:1
std::uint_fast16_t QSCtr
QS ring buffer counter and offset type.
Definition: qs.hpp:250
Internal (package scope) QS/C++ interface.
#define QS_INSERT_ESC_BYTE_(b_)
Internal QS macro to insert an escaped byte into the QS buffer.
Definition: qs_pkg.hpp:92