Find the byte offset where `__HALT_COMPILER(); ?>` begins.
(data: &[u8])
| 147 | |
| 148 | /// Find the byte offset where `__HALT_COMPILER(); ?>` begins. |
| 149 | fn find_marker(data: &[u8]) -> Option<usize> { |
| 150 | let marker = HALT_COMPILER_MARKER; |
| 151 | let len = marker.len(); |
| 152 | if data.len() < len { |
| 153 | return None; |
| 154 | } |
| 155 | for i in 0..=data.len() - len { |
| 156 | if &data[i..i + len] == marker { |
| 157 | return Some(i); |
| 158 | } |
| 159 | } |
| 160 | None |
| 161 | } |
| 162 | |
| 163 | /// Read a little-endian `u32` from `data` at `*cursor`, advancing the cursor. |
| 164 | fn read_u32(data: &[u8], cursor: &mut usize) -> Option<u32> { |