MallocPitch and pointer

Hi,

can someone tell me, why the following fails:

unsigned char* resultr = (unsigned char*) ((char*) target->d_pointer + y * target->d_pitch) + (x * target->d_padding) + 2;

This construct is for accessing a pixel in an uploaded image using cudaMallocPitch.

The expression fails with: error: expression must have pointer type

I’m sure its simple, but I dont see it.

Thanks,

Kwyjibo

Hi,

can someone tell me, why the following fails:

unsigned char* resultr = (unsigned char*) ((char*) target->d_pointer + y * target->d_pitch) + (x * target->d_padding) + 2;

This construct is for accessing a pixel in an uploaded image using cudaMallocPitch.

The expression fails with: error: expression must have pointer type

I’m sure its simple, but I dont see it.

Thanks,

Kwyjibo

Never mind, I found it out myself.

The → operator caused the expression, because target was not a pointer but pushed on stack External Image

Never mind, I found it out myself.

The → operator caused the expression, because target was not a pointer but pushed on stack External Image