byte_at Function

private function byte_at(p, offset) result(b)

The byte at offset in the memory at p, as a number from 0 to 255.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in) :: p

start of the memory

integer, intent(in) :: offset

in bytes, 0 for the first byte

Return Value integer


Called by

proc~~byte_at~~CalledByGraph proc~byte_at byte_at proc~find_layout find_layout proc~find_layout->proc~byte_at proc~list_directory list_directory proc~list_directory->proc~byte_at proc~list_directory->proc~find_layout proc~collect_files collect_files proc~collect_files->proc~list_directory proc~directory_files directory_files proc~directory_files->proc~collect_files proc~run run proc~run->proc~directory_files

Source Code

integer function byte_at(p, offset) result(b)
    !! The byte at `offset` in the memory at `p`, as a number from 0 to 255.
    type(c_ptr), intent(in) :: p        !! start of the memory
    integer, intent(in) :: offset       !! in bytes, 0 for the first byte
    integer(c_int8_t), pointer :: raw(:)
    call c_f_pointer(p, raw, [offset + 1])
    b = iand(int(raw(offset + 1)), 255)
end function byte_at