Skip to content

Commit 5bf265b

Browse files
committed
Rename PlatformArchitecture helper PlatformBitness
The `PlatformArchitecture` test helper struct holds information about whether we are 64-bit or 32-bit and whether the system we are running on is 64-bit or 32-bit. It doesn't hold information about architecture beyond that. The name `PlatformArchitecture` made sense in #1456 when this fully captured the relevant architecture distinctions. But now, although `gix-path` doesn't work differently between x86_64 and ARM64 systems, the distinction betwee x86_64 and ARM64 is important in the design. This renames `PlatformArchitecture` to `PlatformBitness`, while names that refer to architecture in a way not completely reducible to a 32-bit vs. 64-bit distinction are not renamed "bitness."
1 parent 2c6dcb2 commit 5bf265b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

gix-path/src/env/git/tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ mod locations {
148148
}
149149

150150
#[derive(Clone, Copy, Debug)]
151-
enum PlatformArchitecture {
151+
enum PlatformBitness {
152152
Is32on32,
153153
Is32on64,
154154
Is64on64,
155155
}
156156

157-
impl PlatformArchitecture {
157+
impl PlatformBitness {
158158
fn current() -> WindowsResult<Self> {
159159
// Ordinarily, we would check the target pointer width first to avoid doing extra work,
160160
// because if this is a 64-bit executable then the operating system is 64-bit. But this
@@ -163,15 +163,15 @@ mod locations {
163163
let mut wow64process = BOOL::default();
164164
unsafe { IsWow64Process(GetCurrentProcess(), &mut wow64process)? };
165165

166-
let platform_architecture = if wow64process.as_bool() {
166+
let platform_bitness = if wow64process.as_bool() {
167167
Self::Is32on64
168168
} else if cfg!(target_pointer_width = "32") {
169169
Self::Is32on32
170170
} else {
171171
assert!(cfg!(target_pointer_width = "64"));
172172
Self::Is64on64
173173
};
174-
Ok(platform_architecture)
174+
Ok(platform_bitness)
175175
}
176176
}
177177

@@ -248,8 +248,8 @@ mod locations {
248248
/// This checks that `obtain_envlessly()` returned paths that are likely to be correct and
249249
/// that satisfy the most important properties based on the current system and process.
250250
fn validated(self) -> Self {
251-
match PlatformArchitecture::current().expect("Process and system 'bitness' should be available") {
252-
PlatformArchitecture::Is32on32 => {
251+
match PlatformBitness::current().expect("Process and system 'bitness' should be available") {
252+
PlatformBitness::Is32on32 => {
253253
assert_eq!(
254254
self.current.as_os_str(),
255255
self.x86.as_os_str(),
@@ -268,7 +268,7 @@ mod locations {
268268
"A 32-bit system has no 64-bit program files directory.",
269269
);
270270
}
271-
PlatformArchitecture::Is32on64 => {
271+
PlatformBitness::Is32on64 => {
272272
assert_eq!(
273273
self.current.as_os_str(),
274274
self.x86.as_os_str(),
@@ -283,7 +283,7 @@ mod locations {
283283
"The 32-bit and 64-bit program files directories have different locations.",
284284
);
285285
}
286-
PlatformArchitecture::Is64on64 => {
286+
PlatformBitness::Is64on64 => {
287287
let pf_64bit = self
288288
.maybe_64bit
289289
.as_ref()

0 commit comments

Comments
 (0)