Re: bigint and pow

2022-10-01 Thread rassoc via Digitalmars-d-learn
On 10/2/22 00:04, Fausto via Digitalmars-d-learn wrote: Hello, I am trying to use pow with an integer argument, but I cannot have a bigint result, for example, ```pow(10,72)```. Do I have to write my pow function or is there a native solution? thanks, Fausto In contrast to certain

bigint and pow

2022-10-01 Thread Fausto via Digitalmars-d-learn
Hello, I am trying to use pow with an integer argument, but I cannot have a bigint result, for example, ```pow(10,72)```. Do I have to write my pow function or is there a native solution? thanks, Fausto

Re: Linker Error with Template Function

2022-10-01 Thread Ali Çehreli via Digitalmars-d-learn
On 10/1/22 11:15, Kyle Ingraham wrote: > storing structs as > `void*` in a wrapper struct with information about their module and > identifier saved elsewhere. Perhaps unrelated but that part reminded me of the following discussion:

Re: Setting import paths - project (dub) and also rdmd or dmd

2022-10-01 Thread David via Digitalmars-d-learn
Thank you Steven and Christian. I had a look at both those methods, creating a local dmd.conf file almost worked but it wasn't a simple modification, I was hoping it would be as simple as just adding the extra path but it seems that I needed to add the whole path from the existing dmd.conf

Re: How can I get the "owner" of a method?

2022-10-01 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 30 September 2022 at 22:20:06 UTC, Salih Dincer wrote: Maybe this will help you: ```d template Bar(T) { void fun() {} } class Foo(T) { mixin Bar!T b; alias fun = b.fun; void test() { fun(); } } ``` SDB@79 The issue with that is in that case is instead of writing

Re: Linker Error with Template Function

2022-10-01 Thread Kyle Ingraham via Digitalmars-d-learn
On Tuesday, 13 September 2022 at 08:43:45 UTC, Nick Treleaven wrote: On Tuesday, 13 September 2022 at 03:00:17 UTC, Kyle Ingraham wrote: Any suggestions for being able to call one function for any instance given but maintain flexible return types? Not sure if it helps, but you can define

Re: What are best practices around toString?

2022-10-01 Thread tsbockman via Digitalmars-d-learn
On Saturday, 1 October 2022 at 10:02:34 UTC, Salih Dincer wrote: On Saturday, 1 October 2022 at 08:26:43 UTC, tsbockman wrote: `StringBuilder` is a utility shared across the entire project: Appender not good enough; at least in terms of allocating memory and accumulating a string?

Re: How is it possible that countUntil() generates a jump-table when the hayStack is a compile time array?

2022-10-01 Thread realhet via Digitalmars-d-learn
On Saturday, 1 October 2022 at 13:49:12 UTC, H. S. Teoh wrote: On Sat, Oct 01, 2022 at 01:20:08PM +, realhet via Digitalmars-d-learn wrote: It is very good to know. Thank You for the confirmation. Indeed it is really clever. I wrote a parser only to parse the structural elements of

Re: How to do alligned allocation?

2022-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/22 12:57 AM, tsbockman wrote: On Saturday, 1 October 2022 at 01:37:00 UTC, Steven Schveighoffer wrote: The list of bit sizes is currently here: I'm pretty sure those are in **bytes** not **bits**. Yes, I meant bytes, sorry. That's not a list of alignments, it is block sizes for

Re: How is it possible that countUntil() generates a jump-table when the hayStack is a compile time array?

2022-10-01 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Oct 01, 2022 at 01:20:08PM +, realhet via Digitalmars-d-learn wrote: > Hello, > > I just wanted to optimize a byte -> index lookup, by using a 256 > element table instead of using [1, 2, 3].countUntil(x) and I was > amazed what I've found. > My solution lookup[x] was not faster at

How is it possible that countUntil() generates a jump-table when the hayStack is a compile time array?

2022-10-01 Thread realhet via Digitalmars-d-learn
Hello, I just wanted to optimize a byte -> index lookup, by using a 256 element table instead of using [1, 2, 3].countUntil(x) and I was amazed what I've found. My solution lookup[x] was not faster at all, because LDC2 amazingly optimized the linear search to a jump table. Anyone please can

Re: What are best practices around toString?

2022-10-01 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 1 October 2022 at 08:26:43 UTC, tsbockman wrote: So, the first `toString` overload defines how to format the value to text, while the second overload does memory management and forwards the formatting work to the first. `StringBuilder` is a utility shared across the entire

Re: What are best practices around toString?

2022-10-01 Thread tsbockman via Digitalmars-d-learn
On Friday, 30 September 2022 at 13:11:56 UTC, christian.koestlin wrote: Dear Dlang experts, up until now I was perfectly happy with implementing `(override) string toString() const` or something to get nicely formatted (mostly debug) output for my structs, classes and exceptions. Human