Re: Problem with assertThrown

2024-09-09 Thread kookman via Digitalmars-d-learn
On Tuesday, 10 September 2024 at 01:04:15 UTC, Jonathan M Davis wrote: When I run it locally, assertThrown passes as expected for test case 5, and the same happens on run.dlang.io, so nothing in my specific setup is making it pass when it normally wouldn't. So, unless you verified that your

Re: Problem with assertThrown

2024-09-09 Thread kookman via Digitalmars-d-learn
On Tuesday, 10 September 2024 at 00:27:43 UTC, Jonathan M Davis wrote: On Monday, September 9, 2024 5:46:18 PM MDT kookman via Digitalmars-d-learn wrote: It seems like assertThrown works as expected for case 4, but mysteriously not working for case 5 - despite the code under test raising the

Problem with assertThrown

2024-09-09 Thread kookman via Digitalmars-d-learn
I'm having trouble understanding why the assertThrown in unit test 5 is not behaving in the code below: ``` ubyte[] decodeBase32(string encoded) { import std.string: indexOf, stripRight; // Remove padding if present encoded = encoded.stripRight("="); ubyte[] result; size_t

Re: How to pre build vibe-d dub package

2020-05-29 Thread kookman via Digitalmars-d-learn
On Friday, 29 May 2020 at 11:45:24 UTC, Andre Pany wrote: André I do it by defining a configuration “build-deps” in my dub.sdl with target type “none” and then doing the build as two steps in the dockerfile: ``` dockerfile ... WORKDIR /build COPY dub.s* ./ RUN dub build -v —config=build-dep

Re: std.bitmanip help - how to combine bitfields and read

2020-03-10 Thread kookman via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 05:25:43 UTC, kookman wrote: I am using libpcap to read from stored pcap files, and want to use std.bitmanip.bitfields to read TCP flags from the file, using a struct like: struct TcpHeader { align(1): ushort srcPort; ushort dstPort; uint seqNo;

std.bitmanip help - how to combine bitfields and read

2020-03-10 Thread kookman via Digitalmars-d-learn
I am using libpcap to read from stored pcap files, and want to use std.bitmanip.bitfields to read TCP flags from the file, using a struct like: struct TcpHeader { align(1): ushort srcPort; ushort dstPort; uint seqNo; uint ackNo; mixin(bitfields!( bool, "flagFin",

Re: LockingTextWriter not an output range?

2018-04-18 Thread kookman via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 06:40:15 UTC, rikki cattermole wrote: On 18/04/2018 6:28 PM, kookman wrote: The below static assert fails. Is this expected? Not the way I read the docs. static assert (isOutputRange(typeof(stdout.lockingTextWriter), char)); static assert (isOutputRange!(type

Re: LockingTextWriter not an output range?

2018-04-17 Thread kookman via Digitalmars-d-learn
Typo corrected: static assert (isOutputRange!(typeof(stdout.lockingTextWriter), char));

LockingTextWriter not an output range?

2018-04-17 Thread kookman via Digitalmars-d-learn
The below static assert fails. Is this expected? Not the way I read the docs. static assert (isOutputRange(typeof(stdout.lockingTextWriter), char));

Re: RDTSCP from dlang

2016-08-31 Thread kookman via Digitalmars-d-learn
On Wednesday, 31 August 2016 at 08:23:57 UTC, Basile B. wrote: By the way maybe someone could post an ER in bugzilla to get RDTSCP available in iasm w/o using the byte code trick. Someone beat me to it, but see here: https://issues.dlang.org/show_bug.cgi?id=16449

Re: RDTSCP from dlang

2016-08-31 Thread kookman via Digitalmars-d-learn
On Wednesday, 31 August 2016 at 07:36:16 UTC, rikki cattermole wrote: http://dlang.org/spec/abi.html#register_conventions That link talks about for functions defined extern(C) and extern(D), and gives specific info for win32. I'm using linux x86_64, does that mean I can assume standard x8

Re: RDTSCP from dlang

2016-08-31 Thread kookman via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 09:04:41 UTC, Basile B. wrote: ALternatively to Rikki K's solution, you can do this to mimic the rdtscp behavior: asm { cpuid; rdtsc; // store time in locals } // bench { rdtsc; // store time in locals } // compute delta explanations here: - http://www

RDTSCP from dlang

2016-08-29 Thread kookman via Digitalmars-d-learn
I need to access the x86_64 RDTSCP assembly instruction from D. I found this for C++: http://stackoverflow.com/questions/14783782/which-inline-assembly-code-is-correct-for-rdtscp Does anyone here know how (if?) I can do this from D?