On Sunday, 26 September 2021 at 15:09:38 UTC, Paul wrote:
Is there way to write the myStruct data to the file in a single
statement...or two?
Thanks for any assistance.
Header[1] header;
void readFileHeader( ref File f )
{
f.rawRead( header );
}
Finished product...
~15k samples x 2 sin() waves/composite wave x 16 DTMF tones = 16
DTMF wave files in ~40ms!
I love D.
What's with the 4 bytes of zero?
I miss-counted. All is well!
Thanks Ali / Steven
Hmm...well this is what I did and sort of got what I wanted; it
did compile and write data!
auto myStruct = new mystruct[1];
File f = File("myFile.wav", "wb");
f.rawWrite(myStruct); //this is 44 bytes
f.rawWrite(shortWaveArray);
What I got in the file was this:
-my 44 byte myStruct data + (4
On Sunday, 26 September 2021 at 19:00:54 UTC, kinke wrote:
On Sunday, 26 September 2021 at 18:08:46 UTC, james.p.leblanc
wrote:
or even moving the array declarations to before
the dot product function, and the avx instructions will
disappear!
That's because the `@fastmath` UDA applies to the
On Sunday, 26 September 2021 at 18:08:46 UTC, james.p.leblanc
wrote:
or even moving the array declarations to before
the dot product function, and the avx instructions will
disappear!
That's because the `@fastmath` UDA applies to the next
declaration only, which is the `x` array in your 2nd
Dear D-ers,
I enjoyed reading some details of incorporating AVX into math code
from Johan Engelen's programming blog post:
http://johanengelen.github.io/ldc/2016/10/11/Math-performance-LDC.html
Basically, one can use the ldc compiler to insert avx code, nice!
In playing with some variants of
On 9/26/21 11:09 AM, Paul wrote:
I'm building a binary file. I can write my 'short[] myArray' directly
to the file using: File f = File( "myFile.wav", "wb" );
f.rawWrite(myArray); It doesn't write any array formatting stuff (i.e.
'[ , , ]'); it just moves the data into myFile like I want.
Some are available on my website
http://druntime.dpldocs.info/core.sys.html
but the source doesn't include much so it is a bit sparse and all
the version overloads can be awkward to read.
I can't find the core.sys documentation in the library reference.
I thought that functionality was removed but clearly the source
files exist in druntime:
https://github.com/dlang/druntime/tree/master/src/core/sys
Same goes for std.windows:
Correcting my sloppy code. :)
On 9/26/21 8:53 AM, Ali Çehreli wrote:
>// We need an array Ses (length of 1 in this case)
>auto ses = new S[1];
Allocating a dynamic array there is egregious pessimization. The
following works the same but this time the static array of a single S
will be
rawRead and rawWrite work with slices (arrays) of things. You need to
use an array of your struct even if there is a single item. Here is an
example:
import std.stdio;
import std.file;
struct S {
int i;
double d;
}
void readFrom(string name) {
// We need an array Ses (length of 1 in
I'm building a binary file. I can write my 'short[] myArray'
directly to the file using: File f = File( "myFile.wav", "wb" );
f.rawWrite(myArray); It doesn't write any array formatting stuff
(i.e. '[ , , ]'); it just moves the data into myFile like I want.
I can't seem to do this with
On Sunday, 26 September 2021 at 09:48:58 UTC, SealabJaster wrote:
...
I feel I didn't make it clear enough that extracting the code
would be way too much effort than its worth, especially since I'm
not even sure it runs on Linux. So I really wouldn't suggest
going down that route.
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote:
...
I'm not aware of any -betterC package specifically for coroutines.
I have some work done in this regard, but sadly the library
itself isn't really usable at all so if you want to put in the
effort you'd have to probably extract
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote:
Hi there,
I'm new in dlang I specially like betterC. I was hoping that d
fibers would be implemented in without using classes, but there
are not. Is there another way how to use async/await in dlang
better c?
Thank you for your help
On Saturday, 25 September 2021 at 21:32:56 UTC, kinke wrote:
Argh, wrong forum section, proper (identical) post:
https://forum.dlang.org/thread/hcwukzoamezbpzrbk...@forum.dlang.org
17 matches
Mail list logo