brintos

brintos / llvm-project-archived public Read only

0
0
Text · 747 B · 2414c2f Raw
23 lines · cpp
1//===-- Utility.cpp -------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "Utility.h"10#include "CoreSpec.h"11 12void add_uint64(std::vector<uint8_t> &buf, uint64_t val) {13  uint8_t *p = reinterpret_cast<uint8_t *>(&val);14  for (int i = 0; i < 8; i++)15    buf.push_back(*p++);16}17 18void add_uint32(std::vector<uint8_t> &buf, uint32_t val) {19  uint8_t *p = reinterpret_cast<uint8_t *>(&val);20  for (int i = 0; i < 4; i++)21    buf.push_back(*p++);22}23