WebAssembly / custom-page-sizes

Other
3 stars 1 forks source link

Use "Ki" for the power-of-two version of a kilobyte, not "KiB" #9

Closed fitzgen closed 5 months ago

fitzgen commented 5 months ago

Just for consistency, since the spec already uses "Ki".

This is a minor editorial change to the overview document, so I'll just merge it right away.

sunfishcode commented 5 months ago

Apologies for the very pedantic comment here, but the spec's use of "64 Ki" is subtle and if we want to match the spec, we should ideally match its subtlety too.

"Ki" is the abbreviation for the prefix for a factor of 1024 which by itself is effectively unitless, while "KiB" is the abbreviation for the unit of 1024 bytes. The wasm spec uses "64 Ki" for the purpose of describing semantics which operate on unitless integers. It never actually uses "64 Ki" to directly describe a quantity of memory.

However, when talking about quantities of memory or page sizes measured in units of bytes, "KiB" is the correct abbreviation. For example, Wasm doesn't have "64 Ki pages", or "65536 pages"; it has "64 KiB pages", or "65536-byte pages". Similarly, embedded systems don't have "less than 64 Ki memory available", or "less than 65536 memory available"; they have "less than 64 KiB memory available", or "less than 65536 bytes memory available".