Commit graph

236 commits

Author SHA1 Message Date
Martin Kinkelin
b0ef9ac009 Merge remote-tracking branch 'origin/stable' into merge_stable 2024-11-17 01:17:07 +01:00
Jonathan M Davis
b6245b474d
Simplify endian conversion functions in std.bitmanip. (#8822)
* Simplify endian conversion functions in std.bitmanip.

They're overly complex (e.g. testing for the native endianness of the
machine when that's actually completely unnecessary), and they use
unions in a manner that is undefined behavior in C/C++ (since they write
to one field and then read from another). I don't see any mention of
whether that behavior is defined in D in D's spec, but it's probably
undefined in D given that it's undefined in C/C++. Either way, it's an
overly complex solution.

This solution gets rid of all of the endian version checks in
std.bitmanip, and it allows the implementations of the endian conversion
functions to be the same between CTFE and runtime.

* Add additional tests for nativeToLittleEndian.
2024-10-27 02:18:49 -07:00
Vladiwostok
231ae8b68a
Fix D-Scanner linting issues (#9070)
* Fix UndocumentedDeclarationCheck linting issue

* Fix IfConstraintsIndentCheck linting issue

* Address feedback

* Fix publictests CI

* Fix old (libdparse) D-Scanner linting warn
2024-10-27 01:21:56 -07:00
RubyTheRoobster
cd026126db
Issue 24095 - std.bitmanip.bitfields no longer works with bool enum t… (#9043)
* Fix Bugzilla Issue 24095 - std.bitmanip.bitfields no longer works with bool enum types

* Fix trailing whitespace

* Remove extra space
2024-08-19 15:05:36 +03:00
Jeremy Baxter
f176df8475 fix ddoc blunders
Caught with grep -Er '\(\$[A-Za-z]'
2024-07-08 08:09:37 +08:00
Nick Treleaven
ad9f87d1b8 [std.bitmanip] Make 3 examples runnable 2024-06-04 00:53:04 +02:00
0-v-0
4b2ea30979 Remove std.conv import from createStorageAndFields 2024-04-22 22:29:22 +08:00
Dennis Korpel
8729740e32 Mark endianToNativeImpl @trusted 2024-04-02 17:16:37 +08:00
Walter Bright
a44abe9167 use cast() where we can 2024-03-08 11:57:50 -08:00
Ogi-kun
6d6e0b9b9f
Fix std.bitmanip.bitfields documentation (#8902)
Fix std.bitmanip.bitfields documentation

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Merged-on-behalf-of: Dennis <dkorpel@users.noreply.github.com>
2024-01-25 11:47:13 +01:00
Dennis Korpel
37cd223f3a Remove std.conv import from bitfields template 2024-01-07 05:33:56 +08:00
Amaury Séchet
19ac06272d Branchless sign extend in std.bitmanip 2023-01-18 01:32:47 +00:00
RJ Nowling
6034c4f1ed Update parameter name to match documentation
The documentation for flip(size_t) indicates that the variable name is `pos`, but the parameter is named `i`.  This PR changes the parameter name to `pos` to match the documentation.
2022-11-15 06:26:05 +01:00
Luís Ferreira
957b460b70 chore(bitmanip): add missing attributes
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-10-17 00:38:30 +02:00
Nick Treleaven
281f42d306
Fix missing unittests in docs (#8603)
* Fix missing staticArray unittest in docs

Found using https://github.com/dlang/dmd/pull/14527.

* Fix missing FloatRep and DoubleRep unittests in docs

* 2 JSONValue op overloads

* std.random

* detabber

* remove

* std.digest.murmurhash
2022-10-17 05:43:13 +08:00
Johan Engelen
292c38c432
Fix 22838 - BitArray.count reads beyond data
This fixes issue 22838
https://issues.dlang.org/show_bug.cgi?id=22838

All hail AddressSanitizer! ;-)
2022-03-03 01:00:41 +01:00
Per Nordlöw
f027cbe61e Remove need for Unqual in EndianSwapper 2021-09-03 14:30:32 +00:00
Iain Buclaw
f9fc1f612a std.bitmanip: Add testbitarray from dmd testsuite as a unittest 2021-08-26 12:41:35 +00:00
nordlow
f1bcb5270f Annotate std/bitmanip to please dlang/dmd#12520 2021-05-18 04:48:36 +02:00
Andrei Alexandrescu
3c45f08ab6 Reduce template instantiations when importing std.bitmanip 2021-05-08 22:30:56 +09:00
Vladimir Panteleev
e16e0b7b97 Fix Issue 21725 - Specifying null as bitfields variable name now fails 2021-04-25 20:43:24 +08:00
berni44
6f2a0934a7 Adapt imports of std.format to new structure of std.format. 2021-03-19 13:22:00 +01:00
Razvan Nitu
3330ff6ad9
Merge pull request #7799 from berni44/issue_21634
Fix 21634 - std.bitmanip: bitfields may generate invalid variable
2021-02-23 04:02:37 +08:00
berni44
2983202b1c Fix issues 21635, 21636:
std.bitmanip: bitfields should produce better error messages with wrong parameters
std.bitmanip: bitfields size of bitfield should be checked against size of used type
2021-02-16 14:02:03 +01:00
berni44
88496f733a Fix 21634 - std.bitmanip: bitfields may generate invalid variable 2021-02-16 11:28:04 +01:00
berni44
1b7ef49426 Improve documentation and errormessage of bitfields. 2021-02-15 15:26:39 +01:00
berni44
52a06297f8 Tidy up unittests. 2021-02-13 02:48:16 +01:00
Nathan Sashihara
b3978d0a2f Fix Issue 21430 - Add const to front, save, & length properties of range returned by std.bitmanip.bitsSet 2020-11-28 20:00:16 +01:00
Nathan Sashihara
fe1deb2f84 Fix a few places where opDollar could be an alias of length 2020-11-11 02:09:56 +01:00
Andrei Alexandrescu
42138c021c
Replace Unqual-based idiom with immutable-based idiom (#7576)
Replace Unqual-based idiom with immutable-based idiom
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2020-08-04 04:32:14 +02:00
Walter Bright
76caec12f4 bitmanip: make use of new byteswap() function 2020-07-08 13:25:24 +02:00
Geod24
04f3979317 Replace 'Issue XXX' with Bugzilla links
Make the links clickable, as was done in the DMD repository.
Also avoids any ambiguity w.r.t. where the issue is stored.
2020-04-13 16:28:09 +09:00
Martin Nowak
b0d3906d2e Merge remote-tracking branch 'upstream/stable' into merge_stable
Conflicts:
  std/bitmanip.d
2020-03-09 09:30:17 +01:00
MoonlightSentinel
84ee525ff5
Fix Issue 20639 - Some BitArray methods should be const/pure/nothrow/... 2020-03-05 20:11:37 +01:00
Bastiaan Veelo
3b665344b9
Make BitArray.count() const. 2020-03-02 17:39:11 +01:00
MoonlightSentinel
661eefd1a2
Fix Issue 20606 - Cannot cast non-mutable BitArray to void[], size_t[] 2020-02-25 03:04:51 +01:00
Adam D. Ruppe
ae93f5317c Use consistent quickindex wrapper around hand-written list-of-links tables 2020-02-21 21:04:05 -05:00
Steven Schveighoffer
f204ce7444 Mark CTFE bitmanip function for generating longs to a string as @safe and pure.
Helps with proposed DIP1028
2020-01-05 13:44:03 -05:00
MoonlightSentinel
7044e16f3b Remove deprecated BitArray.toString overload 2019-11-16 18:23:04 +01:00
Bernhard Seckinger
c268be460f Remove two duplicate unittests from std.bitmanip; 2019-10-08 17:38:21 +02:00
Vladimir Panteleev
7b0ea1db48
Clarify warning in BitArray.length 2019-09-25 08:01:50 +00:00
Vladimir Panteleev
b808e722b1
Fix Issue 20242 - BitArray constructor should not modify input data 2019-09-25 07:57:03 +00:00
Vladimir Panteleev
289149a2f1
Fix Issue 20241 - BitArray.bitsSet ignores length 2019-09-25 07:50:55 +00:00
Vladimir Panteleev
01fd74a699
Fix Issue 20240 - BitArray inconsistently preserves bits past length 2019-09-25 07:28:08 +00:00
Robert Schadek
8c43f3de63 Addes assert messages to bitmanip
Atila review
2019-07-11 08:32:47 +01:00
Mike
f14acfecb1 Replace D1 operator overloads with D2 operator overloads - Part 2 2019-07-04 17:41:14 +09:00
Mike
e0585fa785 Replace D1 operator overloads with D2 operator overloads 2019-07-04 13:33:53 +09:00
The Dlang Bot
64eac952e3
Merge pull request #7031 from n8sh/bitmanipPopcnt
Use core.bitop.popcnt in std.bitmanip.countBitsSet
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-05-24 21:27:23 +02:00
The Dlang Bot
2b94eb88d6
Merge pull request #7032 from n8sh/bitmanipConsolidateImpl
Pare down std.bitmanip's 13 private impl functions to 4
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-05-24 10:31:51 +02:00
Nathan Sashihara
0c376b40c4 constify scalar arguments in std.bitmanip to reduce IFTI template bloat
Fixes Issue 19899 - std.bitmanip.bitsSet should accept const arguments

This also makes `swapEndian` not propagate `const` to its return value
which is arguably an improvement
(see https://github.com/dlang/phobos/pull/6682#discussion_r213024113).
2019-05-24 03:01:38 -04:00