Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
utils_win.h
Go to the documentation of this file.
1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_PLATFORM_UTILS_WIN_H_
6#define RUNTIME_PLATFORM_UTILS_WIN_H_
7
8#if !defined(RUNTIME_PLATFORM_UTILS_H_)
9#error Do not include utils_win.h directly; use utils.h instead.
10#endif
11
12#include <intrin.h>
13#include <stdlib.h>
14
15namespace dart {
16
17// WARNING: The below functions assume host is always Little Endian!
18
19inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
20 return _byteswap_ushort(value);
21}
22
23inline uint32_t Utils::HostToBigEndian32(uint32_t value) {
24 return _byteswap_ulong(value);
25}
26
27inline uint64_t Utils::HostToBigEndian64(uint64_t value) {
28 return _byteswap_uint64(value);
29}
30
31inline uint16_t Utils::HostToLittleEndian16(uint16_t value) {
32 return value;
33}
34
35inline uint32_t Utils::HostToLittleEndian32(uint32_t value) {
36 return value;
37}
38
39inline uint64_t Utils::HostToLittleEndian64(uint64_t value) {
40 return value;
41}
42
43} // namespace dart
44
45#endif // RUNTIME_PLATFORM_UTILS_WIN_H_
static uint64_t HostToBigEndian64(uint64_t host_value)
static uint64_t HostToLittleEndian64(uint64_t host_value)
static uint16_t HostToLittleEndian16(uint16_t host_value)
static uint32_t HostToLittleEndian32(uint32_t host_value)
static uint16_t HostToBigEndian16(uint16_t host_value)
static uint32_t HostToBigEndian32(uint32_t host_value)
uint8_t value