Re: BitArray - Is there one?

2012-05-28 Thread Dmitry Olshansky
On 29.05.2012 10:52, Era Scarecrow wrote: On Tuesday, 29 May 2012 at 06:30:37 UTC, Dmitry Olshansky wrote: You surely haven't looked at the source code did you? :) It's conceptualy non per bit '-', it's a set difference... I recall looking at it, but to me that just didn't make sense. I could

Re: BitArray - Is there one?

2012-05-28 Thread Era Scarecrow
On Tuesday, 29 May 2012 at 06:30:37 UTC, Dmitry Olshansky wrote: You surely haven't looked at the source code did you? :) It's conceptualy non per bit '-', it's a set difference... I recall looking at it, but to me that just didn't make sense. I could add subtract back and update it (Not many

Re: BitArray - Is there one?

2012-05-28 Thread Dmitry Olshansky
Not at all. Once you established that it's not a pointer namely since every pointer to size_t is word aligned (unless constructed by hand). You could use it's lowest bit as marker then. It's 0 state won't disturb pointer usual semantics, when it's set to 1 it's obviously ... in-place bit array.

Re: BitArray - Is there one?

2012-05-28 Thread Dmitry Olshansky
On 29.05.2012 4:13, Era Scarecrow wrote: On Monday, 28 May 2012 at 21:59:36 UTC, Dmitry Olshansky wrote: Check your math. Xor != sub. 1 ^ 0 == 1, 0 ^ 1 == 1; Compare with 1 0 == 1, 0 1 == 0. That is, for one thing, sub is asymmetric :) Hmm well subs would all happen at the 1 bit level. So

Re: BitArray - Is there one?

2012-05-28 Thread Dmitry Olshansky
On 29.05.2012 6:09, Era Scarecrow wrote: On Sunday, 27 May 2012 at 18:25:38 UTC, Jonathan M Davis wrote: AFAIK, there are no plans to get rid of it due to the bool packing in std.container.Array, so if there's anything that you can do to improve it, go right ahead. Help is welcome. Annoying,

Re: BitArray - Is there one?

2012-05-28 Thread jerro
That is, for one thing, sub is asymmetric :) Hmm well subs would all happen at the 1 bit level. So let's compare. xor 0 ^ 0 = 0 0 ^ 1 = 1 1 ^ 0 = 1 1 ^ 1 = 0 sub 0 - 0 = 0 0 - 1 = -1 (or non-zero/true, truncates to 1) 1 - 0 = 1 1 - 1 = 0 Sorry, seems the same unless we are going with carry

Re: BitArray - Is there one?

2012-05-28 Thread Jonathan M Davis
On Tuesday, May 29, 2012 04:09:48 Era Scarecrow wrote: > On Sunday, 27 May 2012 at 18:25:38 UTC, Jonathan M Davis wrote: > > AFAIK, there are no plans to get rid of it due to the bool > > packing in std.container.Array, so if there's anything that you > > can do to improve it, go right ahead. Help

Re: BitArray - Is there one?

2012-05-28 Thread Era Scarecrow
On Sunday, 27 May 2012 at 18:25:38 UTC, Jonathan M Davis wrote: AFAIK, there are no plans to get rid of it due to the bool packing in std.container.Array, so if there's anything that you can do to improve it, go right ahead. Help is welcome. Annoying, twice I've tried to branch/fork to post

Re: BitArray - Is there one?

2012-05-28 Thread Era Scarecrow
On Monday, 28 May 2012 at 21:59:36 UTC, Dmitry Olshansky wrote: Check your math. Xor != sub. 1 ^ 0 == 1, 0 ^ 1 == 1; Compare with 1 0 == 1, 0 1 == 0. That is, for one thing, sub is asymmetric :) Hmm well subs would all happen at the 1 bit level. So let's compare. xor 0 ^ 0 = 0 0 ^ 1 =

Re: BitArray - Is there one?

2012-05-28 Thread Dmitry Olshansky
On 29.05.2012 1:39, Era Scarecrow wrote: On Sunday, 27 May 2012 at 18:25:38 UTC, Jonathan M Davis wrote: AFAIK, there are no plans to get rid of it due to the bool packing in std.container.Array, so if there's anything that you can do to improve it, go right ahead. Help is welcome. Well so far

Re: BitArray - Is there one?

2012-05-28 Thread Era Scarecrow
On Sunday, 27 May 2012 at 18:25:38 UTC, Jonathan M Davis wrote: AFAIK, there are no plans to get rid of it due to the bool packing in std.container.Array, so if there's anything that you can do to improve it, go right ahead. Help is welcome. Well so far the biggest problem I have is trying to

Converting from string to enum by name

2012-05-28 Thread Jarl André
Hi I have a project on github, https://github.com/jarlah/d2-simple-socket-server, where I have added very custom logger library. In this logger library I have an enum LogLevel that looks like enum LogLevel { ALL, INFO, WARNING etc } Questions: 1. Is there a way to convert from string "INFO

Re: speeding up + ctfe question

2012-05-28 Thread maarten van damme
I didn't use divisions or remainders, only multiplications. I've changed it so it only uses addition and now it still doesn't outperform a version that only checks odd's. it's not as fast as your version where every index corresponds to i*2+1 because I fill every even number with false...

Re: speeding up + ctfe question

2012-05-28 Thread jerro
I tried using 6k+-1 for all primes and for some reason it performed slower. I think I have something completely inefficient somewhere, can't figure out where though. You aren't, by any chance, using divisions or remainders? those are much slower than, say, multiplications (unless the divisor i

Re: speeding up + ctfe question

2012-05-28 Thread maarten van damme
I tried using 6k+-1 for all primes and for some reason it performed slower. I think I have something completely inefficient somewhere, can't figure out where though. I think it has something to do with me increasing k and then multiplying with k while I could have simply added 6 to K... and I have