How to transfer [u8;32] to gpu

in c++

uint8_t *gensig

but i have

let buffer : [u8;32]

how can i transfer buffer to gensig?

What do you mean by transfer? The uint8_t * type is a pointer, and points to data stored somewhere else; it doesn't make sense to transfer the data into a pointer. If you just want to make a pointer, you can do this:

let mut buffer: [u8;32] = [0; 32];
let ptr: *mut u8 = buffer.as_mut_ptr();
fn update_gpu_signal(sig_ptr: &[u8])

can i parse the buffer to fn?

update_gpu_signal(&buffer)

If update_gpu_signal takes a &[u8] and not a raw pointer, you can just use &buffer, yes.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.