summaryrefslogtreecommitdiff
path: root/vendor/github.com/shirou/gopsutil/v4/internal/common/endian.go
blob: 113ff2e9f4256720a4b88a4e118cee3bb053ea5d (plain)
1
2
3
4
5
6
7
8
9
10
11
// SPDX-License-Identifier: BSD-3-Clause
package common

import "unsafe"

// IsLittleEndian checks if the current platform uses little-endian.
// copied from https://github.com/ntrrg/ntgo/blob/v0.8.0/runtime/infrastructure.go#L16 (MIT License)
func IsLittleEndian() bool {
	var x int16 = 0x0011
	return *(*byte)(unsafe.Pointer(&x)) == 0x11
}