@@ -27,12 +27,12 @@ private string myToString()(ulong n)
27
27
{
28
28
UnsignedStringBuf buf;
29
29
auto s = unsignedToTempString(n, buf);
30
- return cast ( string ) s ~ (n > uint .max ? " UL" : " U" );
30
+ return s ~ (n > uint .max ? " UL" : " U" );
31
31
}
32
32
33
33
private alias UnsignedStringBuf = char [20 ];
34
34
35
- private char [] unsignedToTempString ()(ulong value, return char [] buf, uint radix = 10 ) @safe
35
+ private string unsignedToTempString ()(ulong value, char [] buf, uint radix = 10 ) @safe
36
36
{
37
37
size_t i = buf.length;
38
38
do
@@ -41,7 +41,7 @@ private char[] unsignedToTempString()(ulong value, return char[] buf, uint radix
41
41
value = value / radix;
42
42
buf[-- i] = cast (char )((x < 10 ) ? x + ' 0' : x - 10 + ' a' );
43
43
} while (value);
44
- return buf[i .. $];
44
+ return buf[i .. $].idup ;
45
45
}
46
46
47
47
private template createAccessors (
@@ -174,18 +174,18 @@ private ulong getBitsForAlign(ulong a)
174
174
private template createReferenceAccessor (string store, T, ulong bits, string name)
175
175
{
176
176
enum storage = " private void* " ~ store ~ " _ptr;\n " ;
177
- enum storage_accessor = " @property ref size_t " ~ store ~ " () return @trusted pure nothrow @nogc const { "
177
+ enum storage_accessor = " @property ref size_t " ~ store ~ " ()() return @trusted pure nothrow @nogc const { "
178
178
~ " return *cast(size_t*) &" ~ store ~ " _ptr;}\n "
179
- ~ " @property void " ~ store ~ " (size_t v) @trusted pure nothrow @nogc { "
179
+ ~ " @property void " ~ store ~ " ()( size_t v) @trusted pure nothrow @nogc { "
180
180
~ " " ~ store ~ " _ptr = cast(void*) v;}\n " ;
181
181
182
182
enum mask = (1UL << bits) - 1 ;
183
183
// getter
184
- enum ref_accessor = " @property " ~ T.stringof~ " " ~ name~ " () @trusted pure nothrow @nogc const { auto result = "
184
+ enum ref_accessor = " @property " ~ T.stringof~ " " ~ name~ " ()() @trusted pure nothrow @nogc const { auto result = "
185
185
~ " (" ~ store~ " & " ~ myToString(~ mask)~ " ); "
186
186
~ " return cast(" ~ T.stringof~ " ) cast(void*) result;}\n "
187
187
// setter
188
- ~ " @property void " ~ name~ " (" ~ T.stringof~ " v) @trusted pure nothrow @nogc { "
188
+ ~ " @property void " ~ name~ " ()( " ~ T.stringof~ " v) @trusted pure nothrow @nogc { "
189
189
~ " assert(((cast(typeof(" ~ store~ " )) cast(void*) v) & " ~ myToString(mask)
190
190
~ ` ) == 0, "Value not properly aligned for '` ~ name~ ` '"); `
191
191
~ store~ " = cast(typeof(" ~ store~ " ))"
0 commit comments