From a0f25640a21d188fcc8f9c71de402c7b36a9ecf6 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Tue, 6 Oct 2020 04:23:36 -0700 Subject: [PATCH] Revert "AP_Math: add bitwise fetch/load 16, 24, 32bit operations" This reverts commit 6efaa295773dc88906fb9576a631e9d0758a9166. --- libraries/AP_Math/bitwise.cpp | 59 ----------------------------------- libraries/AP_Math/bitwise.h | 31 ------------------ 2 files changed, 90 deletions(-) delete mode 100644 libraries/AP_Math/bitwise.cpp delete mode 100644 libraries/AP_Math/bitwise.h diff --git a/libraries/AP_Math/bitwise.cpp b/libraries/AP_Math/bitwise.cpp deleted file mode 100644 index 503b7563f3..0000000000 --- a/libraries/AP_Math/bitwise.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -/* - collection of bitwise and array-wise operations. - */ - - -#include "bitwise.h" - -void loadUint(uint8_t *b, uint16_t v, uint8_t bitCount, bool MSBfirst) -{ - const uint8_t last = bitCount/8; - -// count = 32 -// last = 4 -// MSBfirst = 1; - - for (uint8_t i=0; i> (8*idx); - } -} - -uint16_t fetchU16(const uint8_t *v, bool MSBfirst) -{ - if (MSBfirst) { - return v[1] | (v[0]<<8); - } - return v[0] | (v[1]<<8); -} - -uint32_t fetchU24(const uint8_t *v, bool MSBfirst) -{ - if (MSBfirst) { - return v[2] | (v[1]<<8) | (v[0]<<16); - } - return v[0] | (v[1]<<8) | (v[2]<<16); -} - -uint32_t fetchU32(const uint8_t *v, bool MSBfirst) -{ - if (MSBfirst) { - return v[3] | (v[2]<<8) | (v[1]<<16) | (v[0]<<24); - } - return v[0] | (v[1]<<8) | (v[2]<<16) | (v[3]<<24); -} diff --git a/libraries/AP_Math/bitwise.h b/libraries/AP_Math/bitwise.h deleted file mode 100644 index e12955e429..0000000000 --- a/libraries/AP_Math/bitwise.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -/* - interfaces to ArduPilot collection of bitwise and arraywise operations - */ -#pragma once - -#include - -void loadUint(uint8_t *b, uint16_t v, uint8_t bitCount, bool MSBfirst = true); - -//void loadU16(uint8_t *b, uint16_t v, bool MSBfirst = true) { loadUx(b, v, 16, MSBfirst); } -//void loadU24(uint8_t *b, uint32_t v, bool MSBfirst = true) { loadUx(b, v, 24, MSBfirst); } -//void loadU32(uint8_t *b, uint32_t v, bool MSBfirst = true) { loadUx(b, v, 32, MSBfirst); } -uint16_t fetchU16(const uint8_t *v, bool MSBfirst = true); -uint32_t fetchU24(const uint8_t *v, bool MSBfirst = true); -uint32_t fetchU32(const uint8_t *v, bool MSBfirst = true); - -