blob: e776268d444c4ee7d26defc52fec2ad6d3a10e01 [file] [log] [blame]
// Copyright (C) 2016 The Android Open Source Project
//
// 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.
package device
import "fmt"
const (
UnknownEndian = Endian_UnknownEndian
BigEndian = Endian_BigEndian
LittleEndian = Endian_LittleEndian
)
// MemoryLayout holds information about how memory is fundamentally laid out for a device.
type MemoryLayout struct {
// PointerAlignment is the alignment in bytes of a pointer type.
PointerAlignment int
// PointerSize is the size in bytes of a pointer type.
PointerSize int
// IntegerSize is the size in bytes of a int or unsigned int.
IntegerSize int
// SizeSize is the size in bytes of a size_t.
SizeSize int
// Endian is the natural byte ordering of the memory layout.
Endian Endian
}
func (a MemoryLayout) String() string {
return fmt.Sprintf("Architecture{ alignof(void*): %d, sizeof(void*): %d, sizeof(int): %d, sizeof(size_t): %d, order: %v }",
a.PointerAlignment, a.PointerSize, a.IntegerSize, a.SizeSize, a.Endian)
}