blob: 00a982837489bf0fe243261a3b0d0bd144e62115 [file] [log] [blame]
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import annotations
import enum
from typing import Final
class MachineArch(enum.Enum):
IA32 = ("ia32", "intel", 32)
X64 = ("x64", "intel", 64)
ARM_32 = ("arm32", "arm", 32)
ARM_64 = ("arm64", "arm", 64)
def __init__(self, name: str, arch: str, bits: int) -> None:
self.identifier: Final[str] = name
self.arch: Final[str] = arch
self.bits: Final[int] = bits
@property
def is_arm(self) -> bool:
return self.arch == "arm"
@property
def is_intel(self) -> bool:
return self.arch == "intel"
@property
def is_32bit(self) -> bool:
return self.bits == 32
@property
def is_64bit(self) -> bool:
return self.bits == 64
def __str__(self) -> str:
return self.identifier