Re: byte and short data types use cases

2023-06-10 Thread Cecil Ward via Digitalmars-d-learn
On Sunday, 11 June 2023 at 00:05:52 UTC, H. S. Teoh wrote: On Sat, Jun 10, 2023 at 09:58:12PM +, Cecil Ward via Digitalmars-d-learn wrote: On Friday, 9 June 2023 at 15:07:54 UTC, [...] On contemporary machines, the CPU is so fast that memory access is a much bigger bottleneck than proce

Re: byte and short data types use cases

2023-06-10 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jun 10, 2023 at 09:58:12PM +, Cecil Ward via Digitalmars-d-learn wrote: > On Friday, 9 June 2023 at 15:07:54 UTC, Murloc wrote: [...] > > So you can optimize memory usage by using arrays of things smaller > > than `int` if these are enough for your purposes, but what about > > using th

Re: byte and short data types use cases

2023-06-10 Thread Cecil Ward via Digitalmars-d-learn
On Saturday, 10 June 2023 at 21:58:12 UTC, Cecil Ward wrote: On Friday, 9 June 2023 at 15:07:54 UTC, Murloc wrote: On Friday, 9 June 2023 at 12:56:20 UTC, Cecil Ward wrote: [...] Is this some kind of property? Where can I read more about this? My last example is comms. Protocol headers nee

Re: byte and short data types use cases

2023-06-10 Thread Cecil Ward via Digitalmars-d-learn
On Friday, 9 June 2023 at 15:07:54 UTC, Murloc wrote: On Friday, 9 June 2023 at 12:56:20 UTC, Cecil Ward wrote: On Friday, 9 June 2023 at 11:24:38 UTC, Murloc wrote: If you have four ubyte variables in a struct and then an array of them, then you are getting optimal memory usage. Is this some

Re: byte and short data types use cases

2023-06-10 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 9 June 2023 at 23:51:07 UTC, Basile B. wrote: Yes, a classsic resource is http://www.catb.org/esr/structure-packing/ So you can optimize memory usage by using arrays of things smaller than `int` if these are enough for your purposes, So, is the sorting correct in a structure like

Re: Problem with dmd-2.104.0 -dip1000 & @safe

2023-06-10 Thread Dennis via Digitalmars-d-learn
On Friday, 9 June 2023 at 04:05:27 UTC, An Pham wrote: Getting with below error for following codes. Look like bug? Filed as https://issues.dlang.org/show_bug.cgi?id=23985 You can work around it by marking parameter `a` as `return scope`