Skip to content

Commit

Permalink
Add arm64_32 PSA.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed Oct 3, 2024
1 parent c5653a4 commit a8c8372
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Sources/Site/Posts/2024/10/2024-10-02-arm64_32-PSA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Reminder: Apple Watches use 32 bit pointers

> Since the Series 4 was introduced in 2018, all new Apple Watches have been arm64_32. The last
> Apple Watch to be armv7k was the Series 3.
Source: https://forums.developer.apple.com/forums/thread/759363

What is arm64_32? It's a 64 bit operating system that runs on 32 bit pointers.

When you test on the watchOS simulator, you're typically going to be testing with 64-bit pointers,
so you'll get a 64 bit Int when testing in sim and a 32 bit Int when testing on hardware.

Something as simple as

```swift
print(String(Int(Date.now.timeIntervalSince1970 * 1000)))
```

can work fine in the simulator but causes a runtime crash on hardware. Be mindful of your use of Int
and CGFloat types when deploying code to the Apple Watch.

Here's the output of Int.max on each platform:

| Simulator | Hardware (oh no!) |
|:---------:|:-------------------:|
| ![64 bit pointers on Apple Watch simulator](/gfx/pointers/64bit.png) | ![32 bit pointers on Apple Watch hardware](/gfx/pointers/32bit.png) |

Binary file added site/gfx/pointers/32bit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/gfx/pointers/64bit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a8c8372

Please sign in to comment.