sync.hpp 520 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. namespace nall::CD::Sync {
  3. inline auto create(array_span<uint8_t> sector) -> bool {
  4. if(sector.size() != 12 && sector.size() != 2352) return false;
  5. for(uint n : range(12)) {
  6. sector[n] = ((n == 0 || n == 11) ? 0x00 : 0xff);
  7. }
  8. return true;
  9. }
  10. //
  11. inline auto verify(array_view<uint8_t> sector) -> bool {
  12. if(sector.size() != 12 && sector.size() != 2352) return false;
  13. for(uint n : range(12)) {
  14. if(sector[n] != ((n == 0 || n == 11) ? 0x00 : 0xff)) return false;
  15. }
  16. return true;
  17. }
  18. }