Re: performance issues with SIMD function

2023-11-04 Thread Bogdan via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:32:08 UTC, Sergey wrote: On Friday, 3 November 2023 at 15:11:31 UTC, Bogdan wrote: Hi everyone, I was playing around with the intel-intrinsics library, trying to improve the speed of a simple area function. I could not see any performance improvements from

performance issues with SIMD function

2023-11-03 Thread Bogdan via Digitalmars-d-learn
Hi everyone, I was playing around with the intel-intrinsics library, trying to improve the speed of a simple area function. I could not see any performance improvements from the non-SIMD implementation. The SIMD version is a little bit slower even with LDC2 and --o3. Can anyone help me to

std.process execute always returns -11 on linuxkit kernel

2022-02-25 Thread Bogdan via Digitalmars-d-learn
Hi everyone, I am trying to build dub in a docker container on a Mac M1 and unfortunately all processes started with the `execute` function from `std.process` always fails with -11. Because of this the `build.d` or `dub` are unusable on this environment. The container that I am using is

Debugging linker errors

2021-08-08 Thread Bogdan via Digitalmars-d-learn
Hi, I tried to update my server from dmd v2.096.1 to v2.097 and I started getting this linker error: ``` Linking... /usr/bin/ld: .dub/build/executable-ssl11-debug-linux.posix-x86_64-dmd_v2.097.2-beta.1-7651E13F70724FF6B1F8D8B61B1AEABD/gis-collective-api.o: in function

Re: Checking for manifest constants

2021-03-06 Thread bogdan via Digitalmars-d-learn
On Friday, 5 March 2021 at 14:42:07 UTC, Petar Kirov [ZombineDev] wrote: On Friday, 5 March 2021 at 08:23:09 UTC, Bogdan wrote: [...] I suggest this: enum globalConfig = 32; int globalValue = 22; immutable globaImmutablelValue = 22; enum isManifestConstant(alias symbol) =

Checking for manifest constants

2021-03-05 Thread Bogdan via Digitalmars-d-learn
I was using a trick with dmd to check for manifest constants which worked until dmd v2.094. Yesterday I tried it on the latest compiler and it failed with: source/introspection/manifestConstant.d(37,28): Error: need this for name of type string source/introspection/type.d(156,13): Error:

dub git dependencies

2021-02-28 Thread bogdan via Digitalmars-d-learn
Hi, I remember that I saw a while ago some PRs related to adding a git url for a dependency in the dub's package.json. I looked today in the docs and I can't find any info about this. What is the progress for this feature? Can we use it already?

Re: initialize float4 (core.simd)

2019-10-06 Thread Bogdan via Digitalmars-d-learn
On Sunday, 6 October 2019 at 11:53:29 UTC, NaN wrote: You should probably have a look at this... https://github.com/AuburnSounds/intel-intrinsics Thanks, that looks quite useful. Also, it seems that I need to use either LDC or GDC instead of DMD. :)

Re: initialize float4 (core.simd)

2019-10-06 Thread Bogdan via Digitalmars-d-learn
On Saturday, 21 September 2019 at 14:31:15 UTC, Stefan Koch wrote: On Saturday, 21 September 2019 at 13:42:09 UTC, Bogdan wrote: Well, this seems to be working: float[4] doSimd(float[4] values, float delta) { float4 v_delta = delta; float4 v_values = __simd(XMM.ADDPS,

Re: initialize float4 (core.simd)

2019-09-21 Thread Bogdan via Digitalmars-d-learn
Well, this seems to be working: float[4] doSimd(float[4] values, float delta) { float4 v_delta = delta; float4 v_values = __simd(XMM.ADDPS, __simd(XMM.LODAPS, values[0]), v_delta); return [v_values[0],

Re: initialize float4 (core.simd)

2019-09-21 Thread Bogdan via Digitalmars-d-learn
Here's a cleaned up version: ``` import std.stdio; import core.simd; void main() { float[4] values = [1.0f, 2.0f, 3.0f, 4.0f]; float delta = 15.0f; writeln(doSimd(values, delta)); } float[4] doSimd(float[4] values, float delta) { float4 v_delta = delta; float4 v_values = values;

initialize float4 (core.simd)

2019-09-21 Thread Bogdan via Digitalmars-d-learn
I'm trying to understand how to use the `core.simd` functionality, and I'm having trouble initializing a float4 vector. Here's my example code: ``` import std.stdio; import core.simd; void main() { float[4] values = [1.0f, 2.0f, 3.0f, 4.0f]; float delta = 15.0f; writeln(doSimd(values,

Re: Creating a RedBlackTree

2019-05-15 Thread Bogdan via Digitalmars-d-learn
On Wednesday, 15 May 2019 at 13:19:36 UTC, drug wrote: You can use predicate for this purpose: ``` auto rbt = redBlackTree!((a, b) => a.ID < b.ID, KeyController); ``` https://run.dlang.io/is/CNRTQf Even better, thank you!

Re: Creating a RedBlackTree

2019-05-15 Thread Bogdan via Digitalmars-d-learn
On Wednesday, 15 May 2019 at 13:15:50 UTC, Stefan Koch wrote: Key controller cannot be compared by less which is why it fails, give it an opCmp and it'll work. Works fine, thank you! For some reason, I thought that this template uses references: ``` enum KeyID: uint { KEY_A,

Creating a RedBlackTree

2019-05-15 Thread Bogdan via Digitalmars-d-learn
I don't have any experience with using templates. Is it possible to create a RB tree containing structs, where the nodes are ordered by one struct member? ``` import std.stdio; import std.container; enum KeyID: uint { KEY_A, KEY_S, KEY_D, KEY_W } struct

Re: Compile time mapping

2019-05-12 Thread Bogdan via Digitalmars-d-learn
On Sunday, 12 May 2019 at 17:53:56 UTC, Bastiaan Veelo wrote: If I understand your question correctly, you have two enums of equal length, and you want to convert members across enums according to their position, right? My question was very vague, sorry about that. In my use case I'd like to

Compile time mapping

2019-05-11 Thread Bogdan via Digitalmars-d-learn
What would be the most straight-forward way of mapping the members of an enum to the members of another enum (one-to-one mapping) at compile time?

Re: Consume binary files

2018-03-10 Thread Bogdan via Digitalmars-d-learn
On Saturday, 10 March 2018 at 18:49:48 UTC, Jonathan M Davis wrote: Check out https://dlang.org/phobos/std_bitmanip.html#peek https://dlang.org/phobos/std_bitmanip.html#read They can be used to read integral values from a range of ubytes. You can use either std.file.read or std.stdio.File

Re: Consume binary files

2018-03-10 Thread Bogdan via Digitalmars-d-learn
... I accidentally posted that before it was complete because I kept pressing TAB in order to indent ... Anyway, I'd like to know if there exists such a thing as ``` int a = stream.ReadInt32(); ```

Consume binary files

2018-03-10 Thread Bogdan via Digitalmars-d-learn
I'm working on a pet project which involves reading various structure types, or just multi-byte values (uin32_t, uint16_t, etc) from files, or just from ubyte arrays. Here's how I've been dealing with some of these situations so far: ``` /// Helper structure used to read each of the file

Do forum posts use any markup language?

2018-03-10 Thread Bogdan via Digitalmars-d-learn
I'd like to distinguish between regular text and code, maybe have quotes, etc.

Re: weird exception on windows

2018-01-05 Thread Szabo Bogdan via Digitalmars-d-learn
On Monday, 18 December 2017 at 22:49:30 UTC, unleashy wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo,

Re: weird exception on windows

2017-12-18 Thread Szabo Bogdan via Digitalmars-d-learn
On Saturday, 16 December 2017 at 12:01:49 UTC, Steven Schveighoffer wrote: On 12/16/17 5:12 AM, bauss wrote: On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe

Re: weird exception on windows

2017-12-16 Thread Szabo Bogdan via Digitalmars-d-learn
On Friday, 15 December 2017 at 13:56:41 UTC, Kagamin wrote: You said tests fail? class SourceResult { private const { string file; size_t line; } this(string fileName = __FILE__, size_t line = __LINE__, size_t range = 6) nothrow

Re: weird exception on windows

2017-12-16 Thread Szabo Bogdan via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your

Re: weird exception on windows

2017-12-15 Thread Szabo Bogdan via Digitalmars-d-learn
On Friday, 15 December 2017 at 09:24:07 UTC, Kagamin wrote: Try printf debugging in case argument is invalid. ah .. ok ... I tried to debug the issue and it looks like the filename is valid and there is no null value. I am thinking that the value is destroyed before it reach the

Re: weird exception on windows

2017-12-14 Thread Szabo Bogdan via Digitalmars-d-learn
On Thursday, 14 December 2017 at 14:47:25 UTC, Kagamin wrote: writeln(fileName); if (!fileName.exists) { return; } :) I'm not sure I understand this solution...

weird exception on windows

2017-12-14 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, I noticed that sometimes on windows this line of code crashes the test suites. https://github.com/gedaiu/fluent-asserts/blob/master/core/fluentasserts/core/results.d#L1072 This exception can be captured only with a debugger... is it a dmd bug? ``` Thread 25CC created, Entry:

Getting the coverage data at runtime

2017-06-18 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, I am wondering if there is any way of getting the code coverage at runtime... As a I seen in the runtime, the .lst files are created inside this module dealocator: https://github.com/dlang/druntime/blob/master/src/rt/cover.d#L152 and the `Cover[] gdata;` is private, so no way of

Re: std.algorithm can not be used inside pure functions?

2017-05-06 Thread Szabo Bogdan via Digitalmars-d-learn
On Saturday, 6 May 2017 at 15:01:16 UTC, Adam D. Ruppe wrote: On Saturday, 6 May 2017 at 14:14:41 UTC, Szabo Bogdan wrote: oh yes, I get it... begin and end are `SysTime`.. there is any workaround for this? Don't use pure? I don't think any of the SysTime conversion methods are pure since

Re: std.algorithm can not be used inside pure functions?

2017-05-06 Thread Szabo Bogdan via Digitalmars-d-learn
On Saturday, 6 May 2017 at 13:21:10 UTC, Adam D. Ruppe wrote: On Saturday, 6 May 2017 at 13:19:17 UTC, Szabo Bogdan wrote: a.begin.toISOExtString, I believe that function is not marked pure if it is a SysTime because it needs to pull global timezone info. What is the type of a.begin? oh

std.algorithm can not be used inside pure functions?

2017-05-06 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, I'm trying to write a function that saves some structs as csv file: ``` string toCsv(const(StatStorage) storage) { return storage.values .map!(a => [ a.name, a.begin.toISOExtString, a.end.toISOExtString, a.status.to!string ]) .map!(a => a.join(',')) .join('\n'); } ``` I

Re: Stack Trace format

2017-04-30 Thread Szabo Bogdan via Digitalmars-d-learn
On Sunday, 30 April 2017 at 20:31:09 UTC, Szabo Bogdan wrote: Hi, I noticed that on different platforms the `object.Throwable.TraceInfo` has different formats. A program compiled on osx with ldc2 has all the TraceInfo empty... Why? I want to parse those strings or somehow iterate trough all

Stack Trace format

2017-04-30 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, I noticed that on different platforms the `object.Throwable.TraceInfo` has different formats. A program compiled on osx with ldc2 has all the TraceInfo empty... Why? I want to parse those strings or somehow iterate trough all the stack elements, but if I get a different format on

Re: code review based on what I learned from D

2015-07-06 Thread Bogdan via Digitalmars-d-learn
On Sunday, 5 July 2015 at 09:46:19 UTC, ketmar wrote: On Sun, 05 Jul 2015 21:39:23 +1200, Rikki Cattermole wrote: Of course of course. Valid options in failing gracefully include resetting the data and informing the user. Also giving them an option to send a bug report to the devs. Point

code review based on what I learned from D

2015-07-05 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, Recently while I was reviewing some swift code, a colleague left me the impression that I am the one with the bad habits and these were learned while coding in D. I still think that I proposed some changes to avoid some bugs but I was told that I am focusing on defensive programming and

sign oauth request

2014-09-25 Thread szabo bogdan via Digitalmars-d-learn
Hi, How I can sign a request for flickrl oauth api? https://www.flickr.com/services/api/auth.oauth.html#request_token there is no HMAC-SHA1 algorithm in phobos library... should I implement it from scratch? Thanks, Bogdan

Re: sign oauth request

2014-09-25 Thread szabo bogdan via Digitalmars-d-learn
which lib do you recommand? On Thursday, 25 September 2014 at 16:19:41 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Sep 25, 2014 at 03:57:36PM +, szabo bogdan via Digitalmars-d-learn wrote: Hi, How I can sign a request for flickrl oauth api? https://www.flickr.com/services/api

Re: sign oauth request

2014-09-25 Thread szabo bogdan via Digitalmars-d-learn
On Thursday, 25 September 2014 at 17:09:40 UTC, Adam D. Ruppe wrote: On Thursday, 25 September 2014 at 17:03:43 UTC, John Chapman wrote: http://dlang.org/phobos/std_digest_sha.html#SHA1 Not quite the same, the oauth requires hmac. When I did this in my oauth.d for twitter and stuff, I used