Additional checks for overflows and some code cleanup

This commit is contained in:
Andy CA6JAU 2018-10-28 19:03:37 -03:00
parent 3284a72feb
commit e0332c4efa
8 changed files with 37 additions and 60 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
* Copyright (C) 2018 by Andy Uribe CA6JAU
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,16 +20,13 @@
#if !defined(YSFDEFINES_H)
#define YSFDEFINES_H
const unsigned int YSF_FRAME_LENGTH_BYTES = 120U;
const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U;
const unsigned int YSF_FRAME_LENGTH_SYMBOLS = YSF_FRAME_LENGTH_BYTES * 4U;
const unsigned int YSF_FRAME_LENGTH_BYTES = 120U;
const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U;
const unsigned int YSF_SYNC_LENGTH_BYTES = 5U;
const unsigned int YSF_SYNC_LENGTH_BITS = YSF_SYNC_LENGTH_BYTES * 8U;
const unsigned int YSF_SYNC_LENGTH_SYMBOLS = YSF_SYNC_LENGTH_BYTES * 4U;
const unsigned int YSF_SYNC_LENGTH_BYTES = 5U;
const unsigned int YSF_SYNC_LENGTH_BITS = YSF_SYNC_LENGTH_BYTES * 8U;
const unsigned int YSF_FICH_LENGTH_BITS = 200U;
const unsigned int YSF_FICH_LENGTH_SYMBOLS = 100U;
const unsigned int YSF_FICH_LENGTH_BITS = 200U;
const uint8_t YSF_SYNC_BYTES[] = {0xD4U, 0x71U, 0xC9U, 0x63U, 0x4DU};
const uint8_t YSF_SYNC_BYTES_LENGTH = 5U;
@ -36,11 +34,5 @@ const uint8_t YSF_SYNC_BYTES_LENGTH = 5U;
const uint64_t YSF_SYNC_BITS = 0x000000D471C9634DU;
const uint64_t YSF_SYNC_BITS_MASK = 0x000000FFFFFFFFFFU;
// D 4 7 1 C 9 6 3 4 D
// 11 01 01 00 01 11 00 01 11 00 10 01 01 10 00 11 01 00 11 01
// -3 +3 +3 +1 +3 -3 +1 +3 -3 +1 -1 +3 +3 -1 +3 -3 +3 +1 -3 +3
const uint32_t YSF_SYNC_SYMBOLS = 0x0007B5ADU;
const uint32_t YSF_SYNC_SYMBOLS_MASK = 0x000FFFFFU;
#endif