iree/vm/buffer.c
static iree_status_t iree_vm_buffer_map_rw(const iree_vm_buffer_t* buffer,
                                           iree_host_size_t offset,
                                           iree_host_size_t length,
                                           iree_host_size_t alignment,
                                           iree_byte_span_t* out_span) {
  // Buffer requires mutable access.
  if (IREE_UNLIKELY(
          !iree_all_bits_set(buffer->access, IREE_VM_BUFFER_ACCESS_MUTABLE))) {
    return iree_make_status(
        IREE_STATUS_PERMISSION_DENIED,
        "buffer is read-only and cannot be mapped for mutation");
  }
  return iree_vm_buffer_map(buffer, offset, length, alignment, &out_span->data,
                            &out_span->data_length);
}
// Maps a subrange to a span of bytes within the |buffer| for read/write access.
// |offset| and |length| must match the provided |alignment| (1, 2, 4, 8) and
// will be rounded toward zero if they do not.
Maps a subrange to a span of bytes within the |buffer| for read/write access.
Maps a subrange to a span of bytes within the |buffer| for read / write access .
static iree_status_t iree_vm_buffer_map_rw(const iree_vm_buffer_t* buffer,
                                           iree_host_size_t offset,
                                           iree_host_size_t length,
                                           iree_host_size_t alignment,
                                           iree_byte_span_t* out_span) {
  if (IREE_UNLIKELY(
          !iree_all_bits_set(buffer->access, IREE_VM_BUFFER_ACCESS_MUTABLE))) {
    return iree_make_status(
        IREE_STATUS_PERMISSION_DENIED,
        "buffer is read-only and cannot be mapped for mutation");
  }
  return iree_vm_buffer_map(buffer, offset, length, alignment, &out_span->data,
                            &out_span->data_length);
}
static iree_status_t iree_vm_buffer_map_rw ( const iree_vm_buffer_t * buffer , iree_host_size_t offset , iree_host_size_t length , iree_host_size_t alignment , iree_byte_span_t * out_span ) { if ( IREE_UNLIKELY ( ! iree_all_bits_set ( buffer -> access , IREE_VM_BUFFER_ACCESS_MUTABLE ) ) ) { return iree_make_status ( IREE_STATUS_PERMISSION_DENIED , " " ) ; } return iree_vm_buffer_map ( buffer , offset , length , alignment , & out_span -> data , & out_span -> data_length ) ; }
Maps a subrange to a span of bytes within the |buffer| for read/write access.
Maps a subrange to a span of bytes within the |buffer| for read / write access .
// Buffer requires mutable access.