Commit Graph

9 Commits

Author SHA1 Message Date
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
Karoy Lorentey
be0abbbafb [stdlib] _Bitset: Reduce unnecessary overflow checking
This is mostly a code size improvement.
2018-10-05 12:33:25 +01:00
Karoy Lorentey
267b80fe07 [stdlib] _Bitset: Use &* for join and capacity
We know it won’t overflow, because the result will not exceed the capacity, which is guaranteed to fit in an integer.
2018-10-03 12:01:38 +01:00
Karoy Lorentey
18c56540d5 [stdlib] _Bitset: Revert to using division/multiplication
However, convert input values to UInts before dividing them.
2018-10-03 12:01:38 +01:00
Karoy Lorentey
a6f7af161d [stdlib] Bitset: Use explicit left/right shifts instead of multiplication/division by powers-of-two
The divisions don’t get eliminated in -Osize builds.
2018-10-03 12:01:38 +01:00
Karoy Lorentey
3c8ac88778 [stdlib] Remove _Bitset type for now
It is currently unused, but it’s causing issues with the SIL/parse-stlib.sil test.
2018-09-22 02:04:10 +01:00
Karoy Lorentey
a84ece7a26 [stdlib] Bitset: Eliminate a trap that wasn’t optimized away
Signed/unsigned integer conversions check for unrepresentable values; this wasn’t recognized as impossible, so a trap got compiled into the Dictionary lookup path.

Note to self: next time just use bitwise operations.
2018-09-22 02:04:10 +01:00
Karoy Lorentey
1848b37300 [stdlib] Add bitset constructs
Bitsets implement sorted sets over nonnegative integers up to a predetermined maximum value.

These are intended to replace _UnsafeBitMap. The latter will be removed once its usages are eliminated.

- _UnsafeBitset.Word is the underlying abstraction, implementing a bitset using a single UInt value.
- _UnsafeBitset is a view over a contiguous range of words.
- _Bitset is a COW value type implementing the same construct.
2018-09-22 02:04:04 +01:00