diff options
| author | Eugen Wissner <belka@caraus.de> | 2018-02-04 05:38:49 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2018-02-04 07:23:56 +0100 |
| commit | 2cda82eeea484e2d46908462f755edcb4ef56cce (patch) | |
| tree | a1d2aac5461c1c008b281930cddc84e301bdfedf /source | |
| parent | e9f70853c621d58122fe005f6df40d3154a5f156 (diff) | |
| download | tanya-2cda82eeea484e2d46908462f755edcb4ef56cce.tar.gz | |
Fix handling of misaligned bytes in fill
Diffstat (limited to 'source')
| -rw-r--r-- | source/tanya/memory/op.d | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/source/tanya/memory/op.d b/source/tanya/memory/op.d index 9d2bf7b..e113ba0 100644 --- a/source/tanya/memory/op.d +++ b/source/tanya/memory/op.d @@ -32,6 +32,16 @@ else import core.stdc.string; } +version (TanyaNative) +{ + @nogc nothrow pure @system unittest + { + ubyte[2] buffer = 1; + fillMemory(buffer[1 .. $], 0); + assert(buffer[0] == 1 && buffer[1] == 0); + } +} + private enum alignMask = size_t.sizeof - 1; /** @@ -149,31 +159,6 @@ do } } -// Stress test. Checks that `fill` can handle unaligned pointers and different -// lengths. -@nogc nothrow pure @safe unittest -{ - ubyte[192] memory; - - foreach (j; 0 .. 192) - { - foreach (ubyte i, ref ubyte v; memory[j .. $]) - { - v = i; - } - fill(memory[j .. $]); - foreach (ubyte v; memory[j .. $]) - { - assert(v == 0); - } - fill!1(memory[j .. $]); - foreach (ubyte v; memory[j .. $]) - { - assert(v == 1); - } - } -} - /** * Copies starting from the end of $(D_PARAM source) into the end of * $(D_PARAM target). |
