Skip to content

Instantly share code, notes, and snippets.

@Dav1dde
Created April 13, 2013 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dav1dde/5378675 to your computer and use it in GitHub Desktop.
Save Dav1dde/5378675 to your computer and use it in GitHub Desktop.
module test_013;
TypeInfo _V__TypeInfo_d = { 8, 23, d, false, };
import defaultsymbols;
import object;
int vmain()body {
double[] i = [0.0, 1.0];
float b = 2.0;
(i = __concatArrayAd(i, b));
if (((((i[0] == cast(double)0) && (i[1] == cast(double)1)) && (i[2] == cast(double)2)) && (i.length == cast(ulong)3))) {
return 42;
} else {
return 0;
}
}
double[] __concatArrayAd(double[] left, double[] right)body {
void* allocated;
ulong count;
(count = (left.length + right.length));
(allocated = allocDg(_V__TypeInfo_d, count));
__llvm_memcpy_p0i8_p0i8_i64(allocated, cast(void*)left.ptr, (left.length * 8), 0, false);
__llvm_memcpy_p0i8_p0i8_i64((allocated + (left.length * 8)), cast(void*)right.ptr, (right.length * 8), 0, false);
return cast(double*)allocated[0..count];
}
//T compiles:yes
//T retval:42
//T has-passed:yes
// Test appending to an array.
module test_013;
int main()
{
double[] i = [0.0f, 1.0f];
float b = 2.0f;
i = i ~ b;
if(i[0] == 0 && i[1] == 1 && i[2] == 2 && i.length == 3)
return 42;
else
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment