Re: Bit rotation question/challenge

2021-01-30 Thread burt via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:41:59 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 14:40:49 UTC, Afgdr wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: [...] cast as uint and shift. cast the result as ubyte[4]. obiously, that works for n=4 with uint and n=8 for

Re: Bit rotation question/challenge

2021-01-30 Thread burt via Digitalmars-d-learn
On Saturday, 30 January 2021 at 14:17:06 UTC, Paul Backus wrote: On Saturday, 30 January 2021 at 13:30:49 UTC, burt wrote: [...] Now I want to bit-rotate the array as if it is one big integer. You may find `std.bitmanip.BitArray` useful for this:

Bit rotation question/challenge

2021-01-30 Thread burt via Digitalmars-d-learn
I have a static array of `ubyte`s of arbitrary size: ```d ubyte[4] x = [ // in reality, ubyte[64] 0b1000, 0b0001, 0b00010101, 0b0010, ]; ``` Now I want to bit-rotate the array as if it is one big integer. So: ```d ubyte[n] rotateRight(size_t n)(ref const ubyte[n]

Re: Trouble with Android and arsd.jni

2020-09-10 Thread burt via Digitalmars-d-learn
On Thursday, 10 September 2020 at 11:58:51 UTC, kinke wrote: On Thursday, 10 September 2020 at 11:16:55 UTC, burt wrote: However, I am getting linker errors, telling me that _tlsend, _tlsstart and __bss_end__ are missing. Perhaps you happen to use some stale artifacts? These magic symbols

Trouble with Android and arsd.jni

2020-09-10 Thread burt via Digitalmars-d-learn
Hello, I'm trying to upgrade and improve an Android project I was working on a while ago. For this reason, I decided to upgrade my compiler to the newest LDC (v1.23.0). I am using the arsd.jni library for the JNI headers and for initializing the runtime. However, I am getting linker errors,

Re: D on android and d_android

2020-04-07 Thread burt via Digitalmars-d-learn
On Tuesday, 7 April 2020 at 12:29:57 UTC, Adam D. Ruppe wrote: On Tuesday, 7 April 2020 at 11:45:24 UTC, burt wrote: I managed to get it to compile. I had to add __bss_end__ symbol myself and set the value to the value of the `_end` symbol or it wouldn't work. A PR to the LDC druntime is wat

Re: D on android and d_android

2020-04-07 Thread burt via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:13:27 UTC, Adam D. Ruppe wrote: On Thursday, 2 April 2020 at 11:29:24 UTC, burt wrote: Anyway, I don't think this fails to work because of an error in the d_android library. If you find anything else that may cause it, I am glad to know, but thank you for your

Re: D on android and d_android

2020-04-05 Thread burt via Digitalmars-d-learn
On Thursday, 2 April 2020 at 17:16:56 UTC, burt wrote: On Thursday, 2 April 2020 at 12:13:27 UTC, Adam D. Ruppe wrote: On Thursday, 2 April 2020 at 11:29:24 UTC, burt wrote: Anyway, I don't think this fails to work because of an error in the d_android library. If you find anything else that

Re: D on android and d_android

2020-04-02 Thread burt via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:13:27 UTC, Adam D. Ruppe wrote: On Thursday, 2 April 2020 at 11:29:24 UTC, burt wrote: Anyway, I don't think this fails to work because of an error in the d_android library. If you find anything else that may cause it, I am glad to know, but thank you for your

Re: D on android and d_android

2020-04-02 Thread burt via Digitalmars-d-learn
On Thursday, 2 April 2020 at 01:53:30 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 15:04:02 UTC, burt wrote: Well I'm European, so with 10.010 kB I mean 10010 kB = 10.010 MB in American/British. ah, of course. Well, I won't be able to finish it today anyway, so take your time.

Re: D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 15:01:02 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 14:54:35 UTC, burt wrote: libphobos2-ldc.a and libphobos2-ldc-debug.a. Sizes are 2511 kB, 4792 kB, 10.010 kB and 17.378 kB respectively. Those latter two should be megabytes not kilobytes the

Re: D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 14:31:45 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 14:20:25 UTC, burt wrote: Some examples of errors are: Those mean it isn't linking in the libs at all... ugh. do ldc2 -v and it will tell you where the config file is. open that up and see if it

Re: D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 14:16:28 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 14:13:32 UTC, burt wrote: I also wonder if there's a difference between the libphobos2-ldc and libphobos2-ldc-debug.a libraries? Do those mangle differently and could that cause the linker errors?

Re: D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 14:00:39 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 13:36:29 UTC, burt wrote: Sorry, I must have misread this. My LDC version was 1.20.1, not 1.19. did that fix the linker error? The runtimes it downloads are specifically built against 1.19. But

Re: D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
So the correct steps now: 1) get ldc 1.19 specifically and the android NDK 2) do `android-setup /path/to/your/android/ndk` 3) do normal `dub build` Sorry, I must have misread this. My LDC version was 1.20.1, not 1.19. Thanks

Re: D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 11:57:58 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 08:50:01 UTC, burt wrote: I found a README [0] that mentions an "android-dub-build.d" script, which should be a wrapper around `dub build` Ah, I forgot to update that file. There is no

D on android and d_android

2020-04-01 Thread burt via Digitalmars-d-learn
Hi, I'm trying to compile a simple app with D code to Android and trying to use the d_android library for this. While trying to compile a basic sample, I found a README [0] that mentions an "android-dub-build.d" script, which should be a wrapper around `dub build`, but I cannot find this

Re: How can I use heapify in @safe code?

2016-10-01 Thread Burt via Digitalmars-d-learn
On Saturday, 1 October 2016 at 18:36:54 UTC, klmp wrote: On Saturday, 1 October 2016 at 16:59:18 UTC, Burt wrote: [...] It tries too but "heapify" uses the struct "BinaryHeap" that is not safe at all. (either not annotated or @safe not applicable because of what it uses in intern: @system

How can I use heapify in @safe code?

2016-10-01 Thread Burt via Digitalmars-d-learn
Hi, I'd like to use a binary heap from @safe code. I thought @safe is transitive but the following example does not compile: import std.container.binaryheap; @safe // This makes things fail. unittest { // Test range interface. import std.algorithm.comparison : equal;