Re: Templates and SIMD - examining types

2020-07-22 Thread Dennis via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 21:58:16 UTC, Cecil Ward wrote: I need to then work out what is the size of the internal units within the 128-bit value, size in bytes,1 or 2, at compile time. You can use the .sizeof property on the type. ``` import core.simd; void main() { ubyte16 a;

Templates and SIMD - examining types

2020-07-22 Thread Cecil Ward via Digitalmars-d-learn
I am using SIMD and I have a case in a template where I am being passed an argument that is a pointer to a 128-bit chunk of either 16 bytes or 8 uwords but I don’t know which? What’s the best way to discover this at compile time - using the ‘is’ operator ? I forget for the moment. It will only

Re: How DerelictCL works

2020-07-22 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote: Dear, I would like to use OpenCL in D. Thus I try to use DerelictCL. But I fail to use it I encounter this error message: -- /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835):

Re: Good way to send/receive UDP packets?

2020-07-22 Thread wjoe via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 16:14:24 UTC, wjoe wrote: When receiving packets, the IP header contains the destination address of your public IP (the router), which it will translate to the local address according to the port forwarding setup. Pardon me, I meant to say according to the

Re: Good way to send/receive UDP packets?

2020-07-22 Thread wjoe via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 15:26:23 UTC, Dukc wrote: On Wednesday, 22 July 2020 at 13:17:11 UTC, wjoe wrote: - Choosing a port which isn't in use right now isn't good enough because a few minutes later there may be another program using it, too, and for the same reason. But doesn't the

Re: How DerelictCL works

2020-07-22 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote: Dear, I would like to use OpenCL in D. Thus I try to use DerelictCL. But I fail to use it I encounter this error message: Hello, I don't have time at all at the moment for maintaining DerelictCL, can you provide a fully working

Re: Good way to send/receive UDP packets?

2020-07-22 Thread Dukc via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 13:17:11 UTC, wjoe wrote: - Choosing a port which isn't in use right now isn't good enough because a few minutes later there may be another program using it, too, and for the same reason. But doesn't the UDP header include the sender IP address? So together with

Re: Good way to send/receive UDP packets?

2020-07-22 Thread wjoe via Digitalmars-d-learn
On Tuesday, 21 July 2020 at 18:35:34 UTC, notna wrote: well, I guess all your remarks are true... and irrelevant at the same time. please go back and read his first post starts with "I have a project where I need to take and send UDP packets over the Internet"... ... and continues

Re: Alternative to std.range.choose

2020-07-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/22/20 12:33 AM, James Gray wrote: Is there a better way to achieve behaviour similar to rangeFuncIf below? f gives a contrived example of when one might want this. g is how one might try and achieve the same with std.range.choose. import std.stdio; import std.range : only, chain, join,

Re: Alternative to std.range.choose

2020-07-22 Thread James Gray via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 06:16:44 UTC, WebFreak001 wrote: On Wednesday, 22 July 2020 at 04:33:20 UTC, James Gray wrote: [...] it seems `choose` evaluates both arguments instead of using lazy evaluation. IMO this is a broken API to me but it has been like this for longer so this would

Re: Alternative to std.range.choose

2020-07-22 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 04:33:20 UTC, James Gray wrote: Is there a better way to achieve behaviour similar to rangeFuncIf below? f gives a contrived example of when one might want this. g is how one might try and achieve the same with std.range.choose. import std.stdio; import std.range