Re: clz

2017-04-01 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 2 April 2017 at 05:33:31 UTC, rikki cattermole wrote: On 02/04/2017 6:28 AM, Nicholas Wilson wrote: [...] BSR looks like its working. http://x86.renejeschke.de/html/file_module_x86_id_20.html http://stackoverflow.com/a/9353998 Ahh there's a subtraction involved. Many thanks!

Re: clz

2017-04-01 Thread rikki cattermole via Digitalmars-d-learn
On 02/04/2017 6:28 AM, Nicholas Wilson wrote: I have this c++ code with clang uint32_t val = 490560; int leading_zeros = __builtin_clz( val << 1); // equals 0 int leading_ones = __builtin_clz(~val << 1); // equals 1 return (lz == 0 ? lo - 1 : -lz); and want to translate it to D. import

clz

2017-04-01 Thread Nicholas Wilson via Digitalmars-d-learn
I have this c++ code with clang uint32_t val = 490560; int leading_zeros = __builtin_clz( val << 1); // equals 0 int leading_ones = __builtin_clz(~val << 1); // equals 1 return (lz == 0 ? lo - 1 : -lz); and want to translate it to D. import core.bitop : bsf,bsr; uint val = 490560;

Re: Need advice on using DUB registry

2017-04-01 Thread rikki cattermole via Digitalmars-d-learn
On 02/04/2017 2:37 AM, Eric wrote: I'm planning on some day putting a package in the DUB registry. My package is dependent on my "util" package which is a collection of stuff I use across all my projects. Does this mean I also have to put my util package in the DUB registry? Could I just make

Need advice on using DUB registry

2017-04-01 Thread Eric via Digitalmars-d-learn
I'm planning on some day putting a package in the DUB registry. My package is dependent on my "util" package which is a collection of stuff I use across all my projects. Does this mean I also have to put my util package in the DUB registry? Could I just make "util" a git sub module of the

Re: How to continue after the book?

2017-04-01 Thread aberba via Digitalmars-d-learn
On Tuesday, 28 March 2017 at 07:27:31 UTC, I Lindström wrote: After getting the basics down, how did you continue when learning programming in general? I do have a need for which I've been trying out a few languages and D seems by far the best for me. Should I just start doing that project

Re: Interfacing C++ to D

2017-04-01 Thread FreeSlave via Digitalmars-d-learn
On Saturday, 1 April 2017 at 07:37:25 UTC, ANtlord wrote: Hello! Can somebody give a relevant example shows how to use C++ classes in D? I've used the exmaple from https://dlang.org/spec/cpp_interface.html but I get a segmentation fault as result of D application. My application shows

Interfacing C++ to D

2017-04-01 Thread ANtlord via Digitalmars-d-learn
Hello! Can somebody give a relevant example shows how to use C++ classes in D? I've used the exmaple from https://dlang.org/spec/cpp_interface.html but I get a segmentation fault as result of D application. My application shows "Program exited with code -11" Thanks.