Commit graph

131 commits

Author SHA1 Message Date
Nikolay Belov
d0ef5ae5d1 Fix out of bounds. 2014-06-13 17:30:04 -04:00
Nikolay Belov
877ea3ebf2 Use core.bitop.bsf in BitArray.opCmp for more efficient 2014-06-13 17:19:05 -04:00
Nikolay Belov
60111117f5 Fix code review comment: repcace some ifs to one expression 2014-06-13 17:14:22 -04:00
Nikolay Belov
8fbdedee97 Fix codestyle code review comment 2014-06-13 17:14:22 -04:00
Nikolay Belov
16511ad919 Fix BitArray.opCmp 2014-06-13 17:14:22 -04:00
Johannes Bblume
9211f1aad1 fix Issue 10948 - BitArray.opEquals is invalid
https://issues.dlang.org/show_bug.cgi?id=10948

Implemented the fix as proposed by nbelov on Bugzilla. Included are unit tests which would have triggered this bug and also fixed it in opCmp.

The issue was that the 32 bit expression "(1 << n)" was treated as being of size_t, which lead to incorrect bit patterns on 64 bit environments.
2014-05-27 13:47:03 +02:00
Gio Borje
6a747f2237 Update bitmanip.d documentation
Fixed all spelling errors of "Params" from "Parems"
2014-04-29 15:45:40 -07:00
Andrej Mitrovic
ccd1e20d49 Fix Issue 12477 - std.bitmanip should emit informative diagnostics. 2014-04-23 21:49:18 +02:00
k-hara
6f80f6aa03 Add more local imports 2014-03-13 13:13:04 +09:00
Dmitry Olshansky
c78cfd97fb Merge pull request #1901 from Poita/bug12027
Fix Issue 12027 - Iterate set bits in BitArray.
2014-03-01 23:28:51 +03:00
Peter Alexander
5111daa384 Mark countBitsSet and countTrailingZeroes as private for now 2014-02-25 21:52:01 +00:00
k-hara
b391b2ec9f Convert to new alias syntax 2014-02-11 15:27:05 +09:00
Peter Alexander
cb55aa8fca Refine BitArray.init requirements and docuemntation. 2014-02-06 21:17:02 +00:00
Peter Alexander
34a892c63e Reimplement countTrailingZeros using bsf. 2014-02-03 21:25:26 +00:00
Peter Alexander
e8eae7de8d Performance improvements for dense BitArray.bitsSet. 2014-02-02 15:08:10 +00:00
Peter Alexander
08820e2f14 Fix Issue 12027 - Iterate set bits in BitArray.
Also adds:
- countTrailingZeros(v)
- countBitsSet(v)
- bitsSet(v)

Notes:
- There is a `popcnt` function in `core.bitops`, but it only works with `int`.
- `bitsSet(v)` could be a bidirectional and possibly even random access range, but I'll leave that for future work for now.
2014-02-02 12:59:28 +00:00
Daniel Murphy
a656f26e9e Remove use of automatic adjacent string literal concatenation from phobos 2014-01-20 03:42:21 +11:00
monarchdodra
44fe3d88f7 Remove tabs 2014-01-08 08:37:52 +01:00
safety0ff
282e88bc60 Add unittests for bugs which seem to have been fixed over time. 2013-10-03 10:14:24 -04:00
safety0ff
d2b6f04f2f Support degenerate bitfields with fields of length 32 and 64 to match documented constraints. 2013-10-03 10:06:55 -04:00
Hackerpilot
9ecbfa6bc7 Reverted implicit string concatienation changes 2013-07-13 19:42:50 +00:00
Hackerpilot
ae1dcaa3e1 Removed empty declarations. Converted more C-style array declarations to D-style. Removed trailing whitespace 2013-07-13 19:34:37 +00:00
Andrej Mitrovic
4f5079e4f8 Fixes Issue 4124 - Implement toString for BitArray. 2013-06-01 15:40:01 +02:00
Andrej Mitrovic
bd2d3e5fea Detab and strip std.bitmanip. 2013-06-01 04:03:37 +02:00
Diggory Blake
be6f984726 Fixed std.bitmanip unit test so that the intended behaviour of checking both endian types is the actual behaviour 2013-05-27 11:26:48 +01:00
kai
17f3fe27d5 Fix endian issue in std.bitmanip
BitArray uses an array of size_t elements but opEquals() and opCmp()
cast it to an array of ubyte elements. On a big endian architecture
the bytes are accessed in wrong order.
The solution is to always use size_t elements.
2013-04-12 07:11:56 +02:00
Marco Nembrini
3bb400d492 Decommented unittest that was blocked by bug 6354, which has since been fixed. 2012-12-28 00:10:15 +11:00
k-hara
01df2f60be Remove redundant parenthesis for getters, and use assignment syntax for setters 2012-11-23 15:07:17 +09:00
Daniel Murphy
9c50d1c72f Remove variable shadowing in std.bitmanip 2012-10-28 21:55:30 +11:00
Kozzi11
b15c4205da Fixes Issue 8876 - bitfields template generate wrong code 2012-10-24 00:06:25 +02:00
alexrp
d913e07fc5 hash_t -> size_t. 2012-10-15 04:45:17 +02:00
nazriel
72ade9efec Add other types to peek & family 2012-09-17 12:46:39 +00:00
alexrp
85c1f161c0 Adding myself as author to the modules I have contributed to.
This is just me committing to maintain my code additions to
these modules. We should, in general, use these author lists
more so we know who's responsible for the various modules.
2012-07-16 05:31:09 +02:00
Matthias Walter
cf08b3e51a Made BitArray.toHash pure. 2012-06-25 08:34:09 +02:00
Matthias Walter
e99d6cf04a Reverted change in opCmp signature. 2012-06-22 08:42:42 +02:00
Matthias Walter
eb46d99217 Added to BitArray in std.bitmanip:
- const modifiers
- const versions of opApply
- toHash method
- return value for length setter.
2012-06-08 21:34:01 +02:00
jmdavis
9cf1eea338 Added checks to verify indices. 2012-06-07 01:27:25 -07:00
jmdavis
b36b6469e1 Made it possible to give endianness to peek, read, write, and append. 2012-06-06 20:39:50 -07:00
jmdavis
5e24378271 Added peek, read, write, and append to std.bitmanip.
These functions make it easier to manipulate buffers of ubytes which are
meant to be parsed or written to as sequences of larger integral types.
They assume that the buffers hold their data in big endian.
2012-06-06 02:21:33 -07:00
alexrp
aaaca447cc Make generated accessor for bitfields @safe pure nothrow. 2012-05-13 23:14:06 +02:00
alexrp
5abc66aec1 Fix overloads of opCast() on BitArray. 2012-03-20 18:32:16 +01:00
alexrp
d70f621afd Allow casting BitArray to size_t[]. 2012-03-19 02:58:33 +01:00
alexrp
4f8b530ba6 More improvements/fixes to BitArray docs. 2012-03-18 00:17:57 +01:00
alexrp
95da96d352 A few improvements to BitArray docs. 2012-03-17 13:06:50 +01:00
Walter Bright
8cfc0d232b 'is' doesn't work for signalling/quiet nan comparison 2012-01-10 00:03:14 -08:00
Walter Bright
380ae65511 remove empty statements 2011-12-29 00:05:45 -08:00
alexrp
cf9ddf9836 Drop unnecessary version statement and use size_t.sizeof * 8 instead. 2011-11-28 10:21:51 +01:00
alexrp
6460899b8a Use D_LP64 to make bitness-based decisions, not X86(_64). 2011-11-27 16:11:23 +01:00
jmdavis
2d3dc6fabe Made it so that the endian swapping functions work with bool. 2011-08-13 20:05:29 -07:00
Andrei Alexandrescu
dc6c28330c Merge pull request #166 from 9rnsr/bitmanipProperty
Add @property to std.bitmanip
2011-08-08 08:34:18 -07:00