• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from __future__ import annotations
6
7import enum
8
9
10class MachineArch(enum.Enum):
11  IA32 = ("ia32", "intel", 32)
12  X64 = ("x64", "intel", 64)
13  ARM_32 = ("arm32", "arm", 32)
14  ARM_64 = ("arm64", "arm", 64)
15
16  def __init__(self, name: str, arch: str, bits: int) -> None:
17    self.identifier = name
18    self.arch = arch
19    self.bits = bits
20
21  @property
22  def is_arm(self) -> bool:
23    return self.arch == "arm"
24
25  @property
26  def is_intel(self) -> bool:
27    return self.arch == "intel"
28
29  @property
30  def is_32bit(self) -> bool:
31    return self.bits == 32
32
33  @property
34  def is_64bit(self) -> bool:
35    return self.bits == 64
36
37  def __str__(self) -> str:
38    return self.identifier
39