… | |
… | |
2020 | |
2020 | |
2021 | Returns the size of the mapped area, in bytes. Same as C<length $$mapped>. |
2021 | Returns the size of the mapped area, in bytes. Same as C<length $$mapped>. |
2022 | |
2022 | |
2023 | =item $ptr = $mapped->ptr |
2023 | =item $ptr = $mapped->ptr |
2024 | |
2024 | |
2025 | Returns the raw memory address of the mapped area - same as C<$mapped+0>. |
2025 | Returns the raw memory address of the mapped area. |
2026 | |
2026 | |
2027 | =item $mapped->set ($offset, $data) |
2027 | =item $mapped->set ($offset, $data) |
2028 | |
2028 | |
2029 | Replaces the data at the given C<$offset> in the memory area by the new |
2029 | Replaces the data at the given C<$offset> in the memory area by the new |
2030 | C<$data>. This method is safer but slower than direct manipulation of |
2030 | C<$data>. This method is safer than direct manipulation of C<$mapped> |
2031 | C<$$mapped> with substr. |
2031 | because it does bounds-checking, but also slower. |
2032 | |
2032 | |
2033 | =item $data = $mapped->get ($offset, $length) |
2033 | =item $data = $mapped->get ($offset, $length) |
2034 | |
2034 | |
2035 | Returns (without copying) a scalar representing the data at the given |
2035 | Returns (without copying) a scalar representing the data at the given |
2036 | C<$offset> and C<$length> in the mapped memory area. This is the same as |
2036 | C<$offset> and C<$length> in the mapped memory area. This is the same as |
2037 | the following substr, except much slower: |
2037 | the following substr, except much slower; |
2038 | |
2038 | |
2039 | $data = substr $$mapped, $offset, $length |
2039 | $data = substr $$mapped, $offset, $length |
2040 | |
2040 | |
2041 | #TODO: really? |
|
|
2042 | |
|
|
2043 | =cut |
2041 | =cut |
2044 | |
2042 | |
2045 | sub get { |
2043 | sub OpenCL::Mapped::get { |
2046 | substr ${$_[0]}, $_[1], $_[2] |
2044 | substr ${$_[0]}, $_[1], $_[2] |
2047 | } |
2045 | } |
2048 | |
2046 | |
2049 | =back |
2047 | =back |
2050 | |
2048 | |