On 07/01/2013 03:23 PM, Tyro[17] wrote:
> So just to confirm my understanding: Because the address at memory is
> casted to ushort* in defining base, every iteration of the foreach loop
> advances the pointer two bytes into the array?
Yes. The incerement operator on a pointer advances the pointe
I'd just like to say thanks for your suggestions and quite complete
solutions. I particularly liked the alternate implementation presented
by Marco. I must admit that I did not understand what was happening at
first.
So just to confirm my understanding: Because the address at memory is
casted
... or alternatively:
// Simple integers can be compile-time literals (i.e. C's #define)
enum ADDRESS_BUS_SIZE = 20; // 2^20 address bus
// In D it is more ideomatic to put the array length first.
// For example this wouldn't work: byte x, *y, memory[1 << ADDRESS_BUS_SIZE];
byte[1 << ADDRESS_BUS_S
Am Sun, 30 Jun 2013 07:07:23 -0400
schrieb "Tyro[17]" :
> What is the equivalent of memcpy
>
> module memcopy;
>
> immutable ADDRESS_BUS_SIZE = 20; // 2^20 address bus
> byte memory[1 << ADDRESS_BUS_SIZE];
>
> void main()
> {
> ushort val = 12345;
>
> for (int i = 0x12340; i < 0x12
On Sun, 30 Jun 2013 07:40:31 -0400, monarch_dodra
wrote:
On Sunday, 30 June 2013 at 11:07:24 UTC, Tyro[17] wrote:
What is the equivalent of memcpy
module memcopy;
immutable ADDRESS_BUS_SIZE = 20; // 2^20 address bus
byte memory[1 << ADDRESS_BUS_SIZE];
void main()
{
ushort val = 12
On Sunday, 30 June 2013 at 11:47:49 UTC, David wrote:
Doing it this way has the advantage of being CTFE-able, and
(potentially) faster, as everything I ever read about D's
memcpy is that
it is slow.
On Windows? Doesn't memcpy use libc memcpy on Linux?
I honestly have no idea, I'm just repea
30-Jun-2013 15:47, David пишет:
Doing it this way has the advantage of being CTFE-able, and
(potentially) faster, as everything I ever read about D's memcpy is that
it is slow.
On Windows? Doesn't memcpy use libc memcpy on Linux?
Yup on Linux is pretty darn fast just as is with C/C++.
It's th
> Doing it this way has the advantage of being CTFE-able, and
> (potentially) faster, as everything I ever read about D's memcpy is that
> it is slow.
On Windows? Doesn't memcpy use libc memcpy on Linux?
On Sunday, 30 June 2013 at 11:07:24 UTC, Tyro[17] wrote:
What is the equivalent of memcpy
module memcopy;
immutable ADDRESS_BUS_SIZE = 20; // 2^20 address bus
byte memory[1 << ADDRESS_BUS_SIZE];
void main()
{
ushort val = 12345;
for (int i = 0x12340; i < 0x1234A; i+= 2) {
What is the equivalent of memcpy
module memcopy;
immutable ADDRESS_BUS_SIZE = 20; // 2^20 address bus
byte memory[1 << ADDRESS_BUS_SIZE];
void main()
{
ushort val = 12345;
for (int i = 0x12340; i < 0x1234A; i+= 2) {
memcpy (&memory[i], &val, sizeof val); // D wa
10 matches
Mail list logo