#How to get the offset of a slice from the beginning of the array it is a slice of?
1 messages · Page 1 of 1 (latest)
Actually, now that I check, ar is itself a slice returned by Allocator.alloc()
if I try to do pointer subtraction I get this:
src/identify.zig:93:42: error: incompatible types: '[*]const u8' and '[]u8'
const offset = block.ptr - file.buf;
~~~~~~~~~~^~~~~~~~~~
src/identify.zig:93:37: note: type '[*]const u8' here
const offset = block.ptr - file.buf;
~~~~~^~~~
src/identify.zig:93:48: note: type '[]u8' here
const offset = block.ptr - file.buf;
~~~~^~~~