LCOV - code coverage report
Current view: top level - AP_PiccoloCAN/piccolo_protocol - scaleddecode.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 130 0.0 %
Date: 2026-09-09 11:02:08 Functions: 0 65 0.0 %

          Line data    Source code
       1             : // scaleddecode.c was generated by ProtoGen version 3.5.c
       2             : 
       3             : /*
       4             :  * This file is free software: you can redistribute it and/or modify it
       5             :  * under the terms of the GNU General Public License as published by the
       6             :  * Free Software Foundation, either version 3 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * This file is distributed in the hope that it will be useful, but
      10             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      12             :  * See the GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License along
      15             :  * with this program.  If not, see <http://www.gnu.org/licenses/>.
      16             :  *
      17             :  * Author: Oliver Walters / Currawong Engineering Pty Ltd
      18             :  */
      19             : 
      20             : #include "scaleddecode.h"
      21             : #include "fielddecode.h"
      22             : 
      23             : 
      24             : /*!
      25             :  * Compute a float using inverse floating point scaling from the base integer
      26             :  * type used for bitfields.
      27             :  * \param value is the integer bitfield number to inverse scale
      28             :  * \param min is the minimum value that can be represented.
      29             :  * \param invscaler is multiplied by the integer to create the return value.
      30             :  *        invscaler should be the inverse of the scaler given to the scaling function.
      31             :  * \return the correctly scaled decoded value: return = min + value*invscaler.
      32             :  */
      33           0 : float float32ScaledFromBitfield(unsigned int value, float min, float invscaler)
      34             : {
      35           0 :     return (float)(min + invscaler*value);
      36             : }
      37             : 
      38             : 
      39             : /*!
      40             :  * Decode a float from a byte stream by inverse floating point scaling from 4
      41             :  * unsigned bytes in big endian order.
      42             :  * \param bytes is a pointer to the byte stream to decode.
      43             :  * \param index gives the location of the first byte in the byte stream, and
      44             :  *        will be incremented by 4 when this function is complete.
      45             :  * \param invscaler is multiplied by the decoded integer to create the return value.
      46             :  *        invscaler should be the inverse of the scaler given to the encode function.
      47             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
      48             :  */
      49           0 : float float32ScaledFrom4UnsignedBeBytes(const uint8_t* bytes, int* index, float min, float invscaler)
      50             : {
      51           0 :     return (float)(min + invscaler*uint32FromBeBytes(bytes, index));
      52             : }
      53             : 
      54             : 
      55             : /*!
      56             :  * Decode a float from a byte stream by inverse floating point scaling from 4
      57             :  * unsigned bytes in little endian order.
      58             :  * \param bytes is a pointer to the byte stream to decode.
      59             :  * \param index gives the location of the first byte in the byte stream, and
      60             :  *        will be incremented by 4 when this function is complete.
      61             :  * \param invscaler is multiplied by the decoded integer to create the return value.
      62             :  *        invscaler should be the inverse of the scaler given to the encode function.
      63             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
      64             :  */
      65           0 : float float32ScaledFrom4UnsignedLeBytes(const uint8_t* bytes, int* index, float min, float invscaler)
      66             : {
      67           0 :     return (float)(min + invscaler*uint32FromLeBytes(bytes, index));
      68             : }
      69             : 
      70             : 
      71             : /*!
      72             :  * Decode a float from a byte stream by inverse floating point scaling from 4
      73             :  * signed bytes in big endian order.
      74             :  * \param bytes is a pointer to the byte stream to decode.
      75             :  * \param index gives the location of the first byte in the byte stream, and
      76             :  *        will be incremented by 4 when this function is complete.
      77             :  * \param min is the minimum value that can be decoded.
      78             :  * \param invscaler is multiplied by the decoded integer to create the return value.
      79             :  *        invscaler should be the inverse of the scaler given to the encode function.
      80             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
      81             :  */
      82           0 : float float32ScaledFrom4SignedBeBytes(const uint8_t* bytes, int* index, float invscaler)
      83             : {
      84           0 :     return (float)(invscaler*int32FromBeBytes(bytes, index));
      85             : }
      86             : 
      87             : 
      88             : /*!
      89             :  * Decode a float from a byte stream by inverse floating point scaling from 4
      90             :  * signed bytes in little endian order.
      91             :  * \param bytes is a pointer to the byte stream to decode.
      92             :  * \param index gives the location of the first byte in the byte stream, and
      93             :  *        will be incremented by 4 when this function is complete.
      94             :  * \param min is the minimum value that can be decoded.
      95             :  * \param invscaler is multiplied by the decoded integer to create the return value.
      96             :  *        invscaler should be the inverse of the scaler given to the encode function.
      97             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
      98             :  */
      99           0 : float float32ScaledFrom4SignedLeBytes(const uint8_t* bytes, int* index, float invscaler)
     100             : {
     101           0 :     return (float)(invscaler*int32FromLeBytes(bytes, index));
     102             : }
     103             : 
     104             : 
     105             : /*!
     106             :  * Decode a float from a byte stream by inverse floating point scaling from 3
     107             :  * unsigned bytes in big endian order.
     108             :  * \param bytes is a pointer to the byte stream to decode.
     109             :  * \param index gives the location of the first byte in the byte stream, and
     110             :  *        will be incremented by 3 when this function is complete.
     111             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     112             :  *        invscaler should be the inverse of the scaler given to the encode function.
     113             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
     114             :  */
     115           0 : float float32ScaledFrom3UnsignedBeBytes(const uint8_t* bytes, int* index, float min, float invscaler)
     116             : {
     117           0 :     return (float)(min + invscaler*uint24FromBeBytes(bytes, index));
     118             : }
     119             : 
     120             : 
     121             : /*!
     122             :  * Decode a float from a byte stream by inverse floating point scaling from 3
     123             :  * unsigned bytes in little endian order.
     124             :  * \param bytes is a pointer to the byte stream to decode.
     125             :  * \param index gives the location of the first byte in the byte stream, and
     126             :  *        will be incremented by 3 when this function is complete.
     127             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     128             :  *        invscaler should be the inverse of the scaler given to the encode function.
     129             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
     130             :  */
     131           0 : float float32ScaledFrom3UnsignedLeBytes(const uint8_t* bytes, int* index, float min, float invscaler)
     132             : {
     133           0 :     return (float)(min + invscaler*uint24FromLeBytes(bytes, index));
     134             : }
     135             : 
     136             : 
     137             : /*!
     138             :  * Decode a float from a byte stream by inverse floating point scaling from 3
     139             :  * signed bytes in big endian order.
     140             :  * \param bytes is a pointer to the byte stream to decode.
     141             :  * \param index gives the location of the first byte in the byte stream, and
     142             :  *        will be incremented by 3 when this function is complete.
     143             :  * \param min is the minimum value that can be decoded.
     144             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     145             :  *        invscaler should be the inverse of the scaler given to the encode function.
     146             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
     147             :  */
     148           0 : float float32ScaledFrom3SignedBeBytes(const uint8_t* bytes, int* index, float invscaler)
     149             : {
     150           0 :     return (float)(invscaler*int24FromBeBytes(bytes, index));
     151             : }
     152             : 
     153             : 
     154             : /*!
     155             :  * Decode a float from a byte stream by inverse floating point scaling from 3
     156             :  * signed bytes in little endian order.
     157             :  * \param bytes is a pointer to the byte stream to decode.
     158             :  * \param index gives the location of the first byte in the byte stream, and
     159             :  *        will be incremented by 3 when this function is complete.
     160             :  * \param min is the minimum value that can be decoded.
     161             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     162             :  *        invscaler should be the inverse of the scaler given to the encode function.
     163             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
     164             :  */
     165           0 : float float32ScaledFrom3SignedLeBytes(const uint8_t* bytes, int* index, float invscaler)
     166             : {
     167           0 :     return (float)(invscaler*int24FromLeBytes(bytes, index));
     168             : }
     169             : 
     170             : 
     171             : /*!
     172             :  * Decode a float from a byte stream by inverse floating point scaling from 2
     173             :  * unsigned bytes in big endian order.
     174             :  * \param bytes is a pointer to the byte stream to decode.
     175             :  * \param index gives the location of the first byte in the byte stream, and
     176             :  *        will be incremented by 2 when this function is complete.
     177             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     178             :  *        invscaler should be the inverse of the scaler given to the encode function.
     179             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
     180             :  */
     181           0 : float float32ScaledFrom2UnsignedBeBytes(const uint8_t* bytes, int* index, float min, float invscaler)
     182             : {
     183           0 :     return (float)(min + invscaler*uint16FromBeBytes(bytes, index));
     184             : }
     185             : 
     186             : 
     187             : /*!
     188             :  * Decode a float from a byte stream by inverse floating point scaling from 2
     189             :  * unsigned bytes in little endian order.
     190             :  * \param bytes is a pointer to the byte stream to decode.
     191             :  * \param index gives the location of the first byte in the byte stream, and
     192             :  *        will be incremented by 2 when this function is complete.
     193             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     194             :  *        invscaler should be the inverse of the scaler given to the encode function.
     195             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
     196             :  */
     197           0 : float float32ScaledFrom2UnsignedLeBytes(const uint8_t* bytes, int* index, float min, float invscaler)
     198             : {
     199           0 :     return (float)(min + invscaler*uint16FromLeBytes(bytes, index));
     200             : }
     201             : 
     202             : 
     203             : /*!
     204             :  * Decode a float from a byte stream by inverse floating point scaling from 2
     205             :  * signed bytes in big endian order.
     206             :  * \param bytes is a pointer to the byte stream to decode.
     207             :  * \param index gives the location of the first byte in the byte stream, and
     208             :  *        will be incremented by 2 when this function is complete.
     209             :  * \param min is the minimum value that can be decoded.
     210             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     211             :  *        invscaler should be the inverse of the scaler given to the encode function.
     212             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
     213             :  */
     214           0 : float float32ScaledFrom2SignedBeBytes(const uint8_t* bytes, int* index, float invscaler)
     215             : {
     216           0 :     return (float)(invscaler*int16FromBeBytes(bytes, index));
     217             : }
     218             : 
     219             : 
     220             : /*!
     221             :  * Decode a float from a byte stream by inverse floating point scaling from 2
     222             :  * signed bytes in little endian order.
     223             :  * \param bytes is a pointer to the byte stream to decode.
     224             :  * \param index gives the location of the first byte in the byte stream, and
     225             :  *        will be incremented by 2 when this function is complete.
     226             :  * \param min is the minimum value that can be decoded.
     227             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     228             :  *        invscaler should be the inverse of the scaler given to the encode function.
     229             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
     230             :  */
     231           0 : float float32ScaledFrom2SignedLeBytes(const uint8_t* bytes, int* index, float invscaler)
     232             : {
     233           0 :     return (float)(invscaler*int16FromLeBytes(bytes, index));
     234             : }
     235             : 
     236             : 
     237             : /*!
     238             :  * Decode a float from a byte stream by inverse floating point scaling from 1
     239             :  * unsigned byte.
     240             :  * \param bytes is a pointer to the byte stream to decode.
     241             :  * \param index gives the location of the first byte in the byte stream, and
     242             :  *        will be incremented by 1 when this function is complete.
     243             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     244             :  *        invscaler should be the inverse of the scaler given to the encode function.
     245             :  * \return the correctly scaled decoded value: return = encoded*invscaler.
     246             :  */
     247           0 : float float32ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, float min, float invscaler)
     248             : {
     249           0 :     return (float)(min + invscaler*uint8FromBytes(bytes, index));
     250             : }
     251             : 
     252             : 
     253             : /*!
     254             :  * Decode a float from a byte stream by inverse floating point scaling from 1
     255             :  * signed byte.
     256             :  * \param bytes is a pointer to the byte stream to decode.
     257             :  * \param index gives the location of the first byte in the byte stream, and
     258             :  *        will be incremented by 1 when this function is complete.
     259             :  * \param min is the minimum value that can be decoded.
     260             :  * \param invscaler is multiplied by the decoded integer to create the return value.
     261             :  *        invscaler should be the inverse of the scaler given to the encode function.
     262             :  * \return the correctly scaled decoded value: return = min + encoded*invscaler.
     263             :  */
     264           0 : float float32ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, float invscaler)
     265             : {
     266           0 :     return (float)(invscaler*int8FromBytes(bytes, index));
     267             : }
     268             : 
     269             : 
     270             : /*!
     271             :  * Compute a uint32_t using inverse integer scaling from the base integer type
     272             :  * used for bitfields.
     273             :  * \param value is the integer bitfield number to inverse scale
     274             :  * \param min is the minimum value that can be represented.
     275             :  * \param divisor is divided into the encoded integer to create the return value.
     276             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     277             :  */
     278           0 : uint32_t uint32ScaledFromBitfield(unsigned int value, int32_t min, uint32_t divisor)
     279             : {
     280           0 :     return (uint32_t)(min + value/divisor);
     281             : }
     282             : 
     283             : 
     284             : /*!
     285             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 4
     286             :  * unsigned bytes in big endian order.
     287             :  * \param bytes is a pointer to the byte stream to decode.
     288             :  * \param index gives the location of the first byte in the byte stream, and
     289             :  *        will be incremented by 4 when this function is complete.
     290             :  * \param min is the minimum value that can be decoded.
     291             :  * \param divisor is divided into the encoded integer to create the return value.
     292             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     293             :  */
     294           0 : uint32_t uint32ScaledFrom4UnsignedBeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     295             : {
     296           0 :     return (uint32_t)(min + uint32FromBeBytes(bytes, index)/divisor);
     297             : }
     298             : 
     299             : 
     300             : /*!
     301             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 4
     302             :  * unsigned bytes in little endian order.
     303             :  * \param bytes is a pointer to the byte stream to decode.
     304             :  * \param index gives the location of the first byte in the byte stream, and
     305             :  *        will be incremented by 4 when this function is complete.
     306             :  * \param min is the minimum value that can be decoded.
     307             :  * \param divisor is divided into the encoded integer to create the return value.
     308             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     309             :  */
     310           0 : uint32_t uint32ScaledFrom4UnsignedLeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     311             : {
     312           0 :     return (uint32_t)(min + uint32FromLeBytes(bytes, index)/divisor);
     313             : }
     314             : 
     315             : 
     316             : /*!
     317             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 4
     318             :  * signed bytes in big endian order.
     319             :  * \param bytes is a pointer to the byte stream to decode.
     320             :  * \param index gives the location of the first byte in the byte stream, and
     321             :  *        will be incremented by 4 when this function is complete.
     322             :  * \param divisor is divided into the encoded integer to create the return value.
     323             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     324             :  */
     325           0 : uint32_t uint32ScaledFrom4SignedBeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     326             : {
     327           0 :     return (uint32_t)(int32FromBeBytes(bytes, index)/divisor);
     328             : }
     329             : 
     330             : 
     331             : /*!
     332             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 4
     333             :  * signed bytes in little endian order.
     334             :  * \param bytes is a pointer to the byte stream to decode.
     335             :  * \param index gives the location of the first byte in the byte stream, and
     336             :  *        will be incremented by 4 when this function is complete.
     337             :  * \param divisor is divided into the encoded integer to create the return value.
     338             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     339             :  */
     340           0 : uint32_t uint32ScaledFrom4SignedLeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     341             : {
     342           0 :     return (uint32_t)(int32FromLeBytes(bytes, index)/divisor);
     343             : }
     344             : 
     345             : 
     346             : /*!
     347             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 3
     348             :  * unsigned bytes in big endian order.
     349             :  * \param bytes is a pointer to the byte stream to decode.
     350             :  * \param index gives the location of the first byte in the byte stream, and
     351             :  *        will be incremented by 3 when this function is complete.
     352             :  * \param min is the minimum value that can be decoded.
     353             :  * \param divisor is divided into the encoded integer to create the return value.
     354             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     355             :  */
     356           0 : uint32_t uint32ScaledFrom3UnsignedBeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     357             : {
     358           0 :     return (uint32_t)(min + uint24FromBeBytes(bytes, index)/divisor);
     359             : }
     360             : 
     361             : 
     362             : /*!
     363             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 3
     364             :  * unsigned bytes in little endian order.
     365             :  * \param bytes is a pointer to the byte stream to decode.
     366             :  * \param index gives the location of the first byte in the byte stream, and
     367             :  *        will be incremented by 3 when this function is complete.
     368             :  * \param min is the minimum value that can be decoded.
     369             :  * \param divisor is divided into the encoded integer to create the return value.
     370             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     371             :  */
     372           0 : uint32_t uint32ScaledFrom3UnsignedLeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     373             : {
     374           0 :     return (uint32_t)(min + uint24FromLeBytes(bytes, index)/divisor);
     375             : }
     376             : 
     377             : 
     378             : /*!
     379             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 3
     380             :  * signed bytes in big endian order.
     381             :  * \param bytes is a pointer to the byte stream to decode.
     382             :  * \param index gives the location of the first byte in the byte stream, and
     383             :  *        will be incremented by 3 when this function is complete.
     384             :  * \param divisor is divided into the encoded integer to create the return value.
     385             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     386             :  */
     387           0 : uint32_t uint32ScaledFrom3SignedBeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     388             : {
     389           0 :     return (uint32_t)(int24FromBeBytes(bytes, index)/divisor);
     390             : }
     391             : 
     392             : 
     393             : /*!
     394             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 3
     395             :  * signed bytes in little endian order.
     396             :  * \param bytes is a pointer to the byte stream to decode.
     397             :  * \param index gives the location of the first byte in the byte stream, and
     398             :  *        will be incremented by 3 when this function is complete.
     399             :  * \param divisor is divided into the encoded integer to create the return value.
     400             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     401             :  */
     402           0 : uint32_t uint32ScaledFrom3SignedLeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     403             : {
     404           0 :     return (uint32_t)(int24FromLeBytes(bytes, index)/divisor);
     405             : }
     406             : 
     407             : 
     408             : /*!
     409             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 2
     410             :  * unsigned bytes in big endian order.
     411             :  * \param bytes is a pointer to the byte stream to decode.
     412             :  * \param index gives the location of the first byte in the byte stream, and
     413             :  *        will be incremented by 2 when this function is complete.
     414             :  * \param min is the minimum value that can be decoded.
     415             :  * \param divisor is divided into the encoded integer to create the return value.
     416             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     417             :  */
     418           0 : uint32_t uint32ScaledFrom2UnsignedBeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     419             : {
     420           0 :     return (uint32_t)(min + uint16FromBeBytes(bytes, index)/divisor);
     421             : }
     422             : 
     423             : 
     424             : /*!
     425             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 2
     426             :  * unsigned bytes in little endian order.
     427             :  * \param bytes is a pointer to the byte stream to decode.
     428             :  * \param index gives the location of the first byte in the byte stream, and
     429             :  *        will be incremented by 2 when this function is complete.
     430             :  * \param min is the minimum value that can be decoded.
     431             :  * \param divisor is divided into the encoded integer to create the return value.
     432             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     433             :  */
     434           0 : uint32_t uint32ScaledFrom2UnsignedLeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     435             : {
     436           0 :     return (uint32_t)(min + uint16FromLeBytes(bytes, index)/divisor);
     437             : }
     438             : 
     439             : 
     440             : /*!
     441             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 2
     442             :  * signed bytes in big endian order.
     443             :  * \param bytes is a pointer to the byte stream to decode.
     444             :  * \param index gives the location of the first byte in the byte stream, and
     445             :  *        will be incremented by 2 when this function is complete.
     446             :  * \param divisor is divided into the encoded integer to create the return value.
     447             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     448             :  */
     449           0 : uint32_t uint32ScaledFrom2SignedBeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     450             : {
     451           0 :     return (uint32_t)(int16FromBeBytes(bytes, index)/divisor);
     452             : }
     453             : 
     454             : 
     455             : /*!
     456             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 2
     457             :  * signed bytes in little endian order.
     458             :  * \param bytes is a pointer to the byte stream to decode.
     459             :  * \param index gives the location of the first byte in the byte stream, and
     460             :  *        will be incremented by 2 when this function is complete.
     461             :  * \param divisor is divided into the encoded integer to create the return value.
     462             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     463             :  */
     464           0 : uint32_t uint32ScaledFrom2SignedLeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     465             : {
     466           0 :     return (uint32_t)(int16FromLeBytes(bytes, index)/divisor);
     467             : }
     468             : 
     469             : 
     470             : /*!
     471             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 1
     472             :  * unsigned byte.
     473             :  * \param bytes is a pointer to the byte stream to decode.
     474             :  * \param index gives the location of the first byte in the byte stream, and
     475             :  *        will be incremented by 1 when this function is complete.
     476             :  * \param min is the minimum value that can be decoded.
     477             :  * \param divisor is divided into the encoded integer to create the return value.
     478             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     479             :  */
     480           0 : uint32_t uint32ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     481             : {
     482           0 :     return (uint32_t)(min + uint8FromBytes(bytes, index)/divisor);
     483             : }
     484             : 
     485             : 
     486             : /*!
     487             :  * Decode a uint32_t from a byte stream by inverse integer scaling from 1
     488             :  * signed byte.
     489             :  * \param bytes is a pointer to the byte stream to decode.
     490             :  * \param index gives the location of the first byte in the byte stream, and
     491             :  *        will be incremented by 1 when this function is complete.
     492             :  * \param divisor is divided into the encoded integer to create the return value.
     493             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     494             :  */
     495           0 : uint32_t uint32ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     496             : {
     497           0 :     return (uint32_t)(int8FromBytes(bytes, index)/divisor);
     498             : }
     499             : 
     500             : 
     501             : /*!
     502             :  * Compute a int32_t using inverse integer scaling from the base integer type
     503             :  * used for bitfields.
     504             :  * \param value is the integer bitfield number to inverse scale
     505             :  * \param min is the minimum value that can be represented.
     506             :  * \param divisor is divided into the encoded integer to create the return value.
     507             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     508             :  */
     509           0 : int32_t int32ScaledFromBitfield(unsigned int value, int32_t min, uint32_t divisor)
     510             : {
     511           0 :     return (int32_t)(min + value/divisor);
     512             : }
     513             : 
     514             : 
     515             : /*!
     516             :  * Decode a int32_t from a byte stream by inverse integer scaling from 4
     517             :  * unsigned bytes in big endian order.
     518             :  * \param bytes is a pointer to the byte stream to decode.
     519             :  * \param index gives the location of the first byte in the byte stream, and
     520             :  *        will be incremented by 4 when this function is complete.
     521             :  * \param min is the minimum value that can be decoded.
     522             :  * \param divisor is divided into the encoded integer to create the return value.
     523             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     524             :  */
     525           0 : int32_t int32ScaledFrom4UnsignedBeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     526             : {
     527           0 :     return (int32_t)(min + uint32FromBeBytes(bytes, index)/divisor);
     528             : }
     529             : 
     530             : 
     531             : /*!
     532             :  * Decode a int32_t from a byte stream by inverse integer scaling from 4
     533             :  * unsigned bytes in little endian order.
     534             :  * \param bytes is a pointer to the byte stream to decode.
     535             :  * \param index gives the location of the first byte in the byte stream, and
     536             :  *        will be incremented by 4 when this function is complete.
     537             :  * \param min is the minimum value that can be decoded.
     538             :  * \param divisor is divided into the encoded integer to create the return value.
     539             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     540             :  */
     541           0 : int32_t int32ScaledFrom4UnsignedLeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     542             : {
     543           0 :     return (int32_t)(min + uint32FromLeBytes(bytes, index)/divisor);
     544             : }
     545             : 
     546             : 
     547             : /*!
     548             :  * Decode a int32_t from a byte stream by inverse integer scaling from 4 signed
     549             :  * bytes in big endian order.
     550             :  * \param bytes is a pointer to the byte stream to decode.
     551             :  * \param index gives the location of the first byte in the byte stream, and
     552             :  *        will be incremented by 4 when this function is complete.
     553             :  * \param divisor is divided into the encoded integer to create the return value.
     554             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     555             :  */
     556           0 : int32_t int32ScaledFrom4SignedBeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     557             : {
     558           0 :     return (int32_t)(int32FromBeBytes(bytes, index)/divisor);
     559             : }
     560             : 
     561             : 
     562             : /*!
     563             :  * Decode a int32_t from a byte stream by inverse integer scaling from 4 signed
     564             :  * bytes in little endian order.
     565             :  * \param bytes is a pointer to the byte stream to decode.
     566             :  * \param index gives the location of the first byte in the byte stream, and
     567             :  *        will be incremented by 4 when this function is complete.
     568             :  * \param divisor is divided into the encoded integer to create the return value.
     569             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     570             :  */
     571           0 : int32_t int32ScaledFrom4SignedLeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     572             : {
     573           0 :     return (int32_t)(int32FromLeBytes(bytes, index)/divisor);
     574             : }
     575             : 
     576             : 
     577             : /*!
     578             :  * Decode a int32_t from a byte stream by inverse integer scaling from 3
     579             :  * unsigned bytes in big endian order.
     580             :  * \param bytes is a pointer to the byte stream to decode.
     581             :  * \param index gives the location of the first byte in the byte stream, and
     582             :  *        will be incremented by 3 when this function is complete.
     583             :  * \param min is the minimum value that can be decoded.
     584             :  * \param divisor is divided into the encoded integer to create the return value.
     585             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     586             :  */
     587           0 : int32_t int32ScaledFrom3UnsignedBeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     588             : {
     589           0 :     return (int32_t)(min + uint24FromBeBytes(bytes, index)/divisor);
     590             : }
     591             : 
     592             : 
     593             : /*!
     594             :  * Decode a int32_t from a byte stream by inverse integer scaling from 3
     595             :  * unsigned bytes in little endian order.
     596             :  * \param bytes is a pointer to the byte stream to decode.
     597             :  * \param index gives the location of the first byte in the byte stream, and
     598             :  *        will be incremented by 3 when this function is complete.
     599             :  * \param min is the minimum value that can be decoded.
     600             :  * \param divisor is divided into the encoded integer to create the return value.
     601             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     602             :  */
     603           0 : int32_t int32ScaledFrom3UnsignedLeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     604             : {
     605           0 :     return (int32_t)(min + uint24FromLeBytes(bytes, index)/divisor);
     606             : }
     607             : 
     608             : 
     609             : /*!
     610             :  * Decode a int32_t from a byte stream by inverse integer scaling from 3 signed
     611             :  * bytes in big endian order.
     612             :  * \param bytes is a pointer to the byte stream to decode.
     613             :  * \param index gives the location of the first byte in the byte stream, and
     614             :  *        will be incremented by 3 when this function is complete.
     615             :  * \param divisor is divided into the encoded integer to create the return value.
     616             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     617             :  */
     618           0 : int32_t int32ScaledFrom3SignedBeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     619             : {
     620           0 :     return (int32_t)(int24FromBeBytes(bytes, index)/divisor);
     621             : }
     622             : 
     623             : 
     624             : /*!
     625             :  * Decode a int32_t from a byte stream by inverse integer scaling from 3 signed
     626             :  * bytes in little endian order.
     627             :  * \param bytes is a pointer to the byte stream to decode.
     628             :  * \param index gives the location of the first byte in the byte stream, and
     629             :  *        will be incremented by 3 when this function is complete.
     630             :  * \param divisor is divided into the encoded integer to create the return value.
     631             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     632             :  */
     633           0 : int32_t int32ScaledFrom3SignedLeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     634             : {
     635           0 :     return (int32_t)(int24FromLeBytes(bytes, index)/divisor);
     636             : }
     637             : 
     638             : 
     639             : /*!
     640             :  * Decode a int32_t from a byte stream by inverse integer scaling from 2
     641             :  * unsigned bytes in big endian order.
     642             :  * \param bytes is a pointer to the byte stream to decode.
     643             :  * \param index gives the location of the first byte in the byte stream, and
     644             :  *        will be incremented by 2 when this function is complete.
     645             :  * \param min is the minimum value that can be decoded.
     646             :  * \param divisor is divided into the encoded integer to create the return value.
     647             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     648             :  */
     649           0 : int32_t int32ScaledFrom2UnsignedBeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     650             : {
     651           0 :     return (int32_t)(min + uint16FromBeBytes(bytes, index)/divisor);
     652             : }
     653             : 
     654             : 
     655             : /*!
     656             :  * Decode a int32_t from a byte stream by inverse integer scaling from 2
     657             :  * unsigned bytes in little endian order.
     658             :  * \param bytes is a pointer to the byte stream to decode.
     659             :  * \param index gives the location of the first byte in the byte stream, and
     660             :  *        will be incremented by 2 when this function is complete.
     661             :  * \param min is the minimum value that can be decoded.
     662             :  * \param divisor is divided into the encoded integer to create the return value.
     663             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     664             :  */
     665           0 : int32_t int32ScaledFrom2UnsignedLeBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     666             : {
     667           0 :     return (int32_t)(min + uint16FromLeBytes(bytes, index)/divisor);
     668             : }
     669             : 
     670             : 
     671             : /*!
     672             :  * Decode a int32_t from a byte stream by inverse integer scaling from 2 signed
     673             :  * bytes in big endian order.
     674             :  * \param bytes is a pointer to the byte stream to decode.
     675             :  * \param index gives the location of the first byte in the byte stream, and
     676             :  *        will be incremented by 2 when this function is complete.
     677             :  * \param divisor is divided into the encoded integer to create the return value.
     678             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     679             :  */
     680           0 : int32_t int32ScaledFrom2SignedBeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     681             : {
     682           0 :     return (int32_t)(int16FromBeBytes(bytes, index)/divisor);
     683             : }
     684             : 
     685             : 
     686             : /*!
     687             :  * Decode a int32_t from a byte stream by inverse integer scaling from 2 signed
     688             :  * bytes in little endian order.
     689             :  * \param bytes is a pointer to the byte stream to decode.
     690             :  * \param index gives the location of the first byte in the byte stream, and
     691             :  *        will be incremented by 2 when this function is complete.
     692             :  * \param divisor is divided into the encoded integer to create the return value.
     693             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     694             :  */
     695           0 : int32_t int32ScaledFrom2SignedLeBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     696             : {
     697           0 :     return (int32_t)(int16FromLeBytes(bytes, index)/divisor);
     698             : }
     699             : 
     700             : 
     701             : /*!
     702             :  * Decode a int32_t from a byte stream by inverse integer scaling from 1
     703             :  * unsigned byte.
     704             :  * \param bytes is a pointer to the byte stream to decode.
     705             :  * \param index gives the location of the first byte in the byte stream, and
     706             :  *        will be incremented by 1 when this function is complete.
     707             :  * \param min is the minimum value that can be decoded.
     708             :  * \param divisor is divided into the encoded integer to create the return value.
     709             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     710             :  */
     711           0 : int32_t int32ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, int32_t min, uint32_t divisor)
     712             : {
     713           0 :     return (int32_t)(min + uint8FromBytes(bytes, index)/divisor);
     714             : }
     715             : 
     716             : 
     717             : /*!
     718             :  * Decode a int32_t from a byte stream by inverse integer scaling from 1 signed
     719             :  * byte.
     720             :  * \param bytes is a pointer to the byte stream to decode.
     721             :  * \param index gives the location of the first byte in the byte stream, and
     722             :  *        will be incremented by 1 when this function is complete.
     723             :  * \param divisor is divided into the encoded integer to create the return value.
     724             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     725             :  */
     726           0 : int32_t int32ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, uint32_t divisor)
     727             : {
     728           0 :     return (int32_t)(int8FromBytes(bytes, index)/divisor);
     729             : }
     730             : 
     731             : 
     732             : /*!
     733             :  * Compute a uint16_t using inverse integer scaling from the base integer type
     734             :  * used for bitfields.
     735             :  * \param value is the integer bitfield number to inverse scale
     736             :  * \param min is the minimum value that can be represented.
     737             :  * \param divisor is divided into the encoded integer to create the return value.
     738             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     739             :  */
     740           0 : uint16_t uint16ScaledFromBitfield(unsigned int value, int16_t min, uint16_t divisor)
     741             : {
     742           0 :     return (uint16_t)(min + value/divisor);
     743             : }
     744             : 
     745             : 
     746             : /*!
     747             :  * Decode a uint16_t from a byte stream by inverse integer scaling from 2
     748             :  * unsigned bytes in big endian order.
     749             :  * \param bytes is a pointer to the byte stream to decode.
     750             :  * \param index gives the location of the first byte in the byte stream, and
     751             :  *        will be incremented by 2 when this function is complete.
     752             :  * \param min is the minimum value that can be decoded.
     753             :  * \param divisor is divided into the encoded integer to create the return value.
     754             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     755             :  */
     756           0 : uint16_t uint16ScaledFrom2UnsignedBeBytes(const uint8_t* bytes, int* index, int16_t min, uint16_t divisor)
     757             : {
     758           0 :     return (uint16_t)(min + uint16FromBeBytes(bytes, index)/divisor);
     759             : }
     760             : 
     761             : 
     762             : /*!
     763             :  * Decode a uint16_t from a byte stream by inverse integer scaling from 2
     764             :  * unsigned bytes in little endian order.
     765             :  * \param bytes is a pointer to the byte stream to decode.
     766             :  * \param index gives the location of the first byte in the byte stream, and
     767             :  *        will be incremented by 2 when this function is complete.
     768             :  * \param min is the minimum value that can be decoded.
     769             :  * \param divisor is divided into the encoded integer to create the return value.
     770             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     771             :  */
     772           0 : uint16_t uint16ScaledFrom2UnsignedLeBytes(const uint8_t* bytes, int* index, int16_t min, uint16_t divisor)
     773             : {
     774           0 :     return (uint16_t)(min + uint16FromLeBytes(bytes, index)/divisor);
     775             : }
     776             : 
     777             : 
     778             : /*!
     779             :  * Decode a uint16_t from a byte stream by inverse integer scaling from 2
     780             :  * signed bytes in big endian order.
     781             :  * \param bytes is a pointer to the byte stream to decode.
     782             :  * \param index gives the location of the first byte in the byte stream, and
     783             :  *        will be incremented by 2 when this function is complete.
     784             :  * \param divisor is divided into the encoded integer to create the return value.
     785             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     786             :  */
     787           0 : uint16_t uint16ScaledFrom2SignedBeBytes(const uint8_t* bytes, int* index, uint16_t divisor)
     788             : {
     789           0 :     return (uint16_t)(int16FromBeBytes(bytes, index)/divisor);
     790             : }
     791             : 
     792             : 
     793             : /*!
     794             :  * Decode a uint16_t from a byte stream by inverse integer scaling from 2
     795             :  * signed bytes in little endian order.
     796             :  * \param bytes is a pointer to the byte stream to decode.
     797             :  * \param index gives the location of the first byte in the byte stream, and
     798             :  *        will be incremented by 2 when this function is complete.
     799             :  * \param divisor is divided into the encoded integer to create the return value.
     800             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     801             :  */
     802           0 : uint16_t uint16ScaledFrom2SignedLeBytes(const uint8_t* bytes, int* index, uint16_t divisor)
     803             : {
     804           0 :     return (uint16_t)(int16FromLeBytes(bytes, index)/divisor);
     805             : }
     806             : 
     807             : 
     808             : /*!
     809             :  * Decode a uint16_t from a byte stream by inverse integer scaling from 1
     810             :  * unsigned byte.
     811             :  * \param bytes is a pointer to the byte stream to decode.
     812             :  * \param index gives the location of the first byte in the byte stream, and
     813             :  *        will be incremented by 1 when this function is complete.
     814             :  * \param min is the minimum value that can be decoded.
     815             :  * \param divisor is divided into the encoded integer to create the return value.
     816             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     817             :  */
     818           0 : uint16_t uint16ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, int16_t min, uint16_t divisor)
     819             : {
     820           0 :     return (uint16_t)(min + uint8FromBytes(bytes, index)/divisor);
     821             : }
     822             : 
     823             : 
     824             : /*!
     825             :  * Decode a uint16_t from a byte stream by inverse integer scaling from 1
     826             :  * signed byte.
     827             :  * \param bytes is a pointer to the byte stream to decode.
     828             :  * \param index gives the location of the first byte in the byte stream, and
     829             :  *        will be incremented by 1 when this function is complete.
     830             :  * \param divisor is divided into the encoded integer to create the return value.
     831             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     832             :  */
     833           0 : uint16_t uint16ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, uint16_t divisor)
     834             : {
     835           0 :     return (uint16_t)(int8FromBytes(bytes, index)/divisor);
     836             : }
     837             : 
     838             : 
     839             : /*!
     840             :  * Compute a int16_t using inverse integer scaling from the base integer type
     841             :  * used for bitfields.
     842             :  * \param value is the integer bitfield number to inverse scale
     843             :  * \param min is the minimum value that can be represented.
     844             :  * \param divisor is divided into the encoded integer to create the return value.
     845             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     846             :  */
     847           0 : int16_t int16ScaledFromBitfield(unsigned int value, int16_t min, uint16_t divisor)
     848             : {
     849           0 :     return (int16_t)(min + value/divisor);
     850             : }
     851             : 
     852             : 
     853             : /*!
     854             :  * Decode a int16_t from a byte stream by inverse integer scaling from 2
     855             :  * unsigned bytes in big endian order.
     856             :  * \param bytes is a pointer to the byte stream to decode.
     857             :  * \param index gives the location of the first byte in the byte stream, and
     858             :  *        will be incremented by 2 when this function is complete.
     859             :  * \param min is the minimum value that can be decoded.
     860             :  * \param divisor is divided into the encoded integer to create the return value.
     861             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     862             :  */
     863           0 : int16_t int16ScaledFrom2UnsignedBeBytes(const uint8_t* bytes, int* index, int16_t min, uint16_t divisor)
     864             : {
     865           0 :     return (int16_t)(min + uint16FromBeBytes(bytes, index)/divisor);
     866             : }
     867             : 
     868             : 
     869             : /*!
     870             :  * Decode a int16_t from a byte stream by inverse integer scaling from 2
     871             :  * unsigned bytes in little endian order.
     872             :  * \param bytes is a pointer to the byte stream to decode.
     873             :  * \param index gives the location of the first byte in the byte stream, and
     874             :  *        will be incremented by 2 when this function is complete.
     875             :  * \param min is the minimum value that can be decoded.
     876             :  * \param divisor is divided into the encoded integer to create the return value.
     877             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     878             :  */
     879           0 : int16_t int16ScaledFrom2UnsignedLeBytes(const uint8_t* bytes, int* index, int16_t min, uint16_t divisor)
     880             : {
     881           0 :     return (int16_t)(min + uint16FromLeBytes(bytes, index)/divisor);
     882             : }
     883             : 
     884             : 
     885             : /*!
     886             :  * Decode a int16_t from a byte stream by inverse integer scaling from 2 signed
     887             :  * bytes in big endian order.
     888             :  * \param bytes is a pointer to the byte stream to decode.
     889             :  * \param index gives the location of the first byte in the byte stream, and
     890             :  *        will be incremented by 2 when this function is complete.
     891             :  * \param divisor is divided into the encoded integer to create the return value.
     892             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     893             :  */
     894           0 : int16_t int16ScaledFrom2SignedBeBytes(const uint8_t* bytes, int* index, uint16_t divisor)
     895             : {
     896           0 :     return (int16_t)(int16FromBeBytes(bytes, index)/divisor);
     897             : }
     898             : 
     899             : 
     900             : /*!
     901             :  * Decode a int16_t from a byte stream by inverse integer scaling from 2 signed
     902             :  * bytes in little endian order.
     903             :  * \param bytes is a pointer to the byte stream to decode.
     904             :  * \param index gives the location of the first byte in the byte stream, and
     905             :  *        will be incremented by 2 when this function is complete.
     906             :  * \param divisor is divided into the encoded integer to create the return value.
     907             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     908             :  */
     909           0 : int16_t int16ScaledFrom2SignedLeBytes(const uint8_t* bytes, int* index, uint16_t divisor)
     910             : {
     911           0 :     return (int16_t)(int16FromLeBytes(bytes, index)/divisor);
     912             : }
     913             : 
     914             : 
     915             : /*!
     916             :  * Decode a int16_t from a byte stream by inverse integer scaling from 1
     917             :  * unsigned byte.
     918             :  * \param bytes is a pointer to the byte stream to decode.
     919             :  * \param index gives the location of the first byte in the byte stream, and
     920             :  *        will be incremented by 1 when this function is complete.
     921             :  * \param min is the minimum value that can be decoded.
     922             :  * \param divisor is divided into the encoded integer to create the return value.
     923             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     924             :  */
     925           0 : int16_t int16ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, int16_t min, uint16_t divisor)
     926             : {
     927           0 :     return (int16_t)(min + uint8FromBytes(bytes, index)/divisor);
     928             : }
     929             : 
     930             : 
     931             : /*!
     932             :  * Decode a int16_t from a byte stream by inverse integer scaling from 1 signed
     933             :  * byte.
     934             :  * \param bytes is a pointer to the byte stream to decode.
     935             :  * \param index gives the location of the first byte in the byte stream, and
     936             :  *        will be incremented by 1 when this function is complete.
     937             :  * \param divisor is divided into the encoded integer to create the return value.
     938             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     939             :  */
     940           0 : int16_t int16ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, uint16_t divisor)
     941             : {
     942           0 :     return (int16_t)(int8FromBytes(bytes, index)/divisor);
     943             : }
     944             : 
     945             : 
     946             : /*!
     947             :  * Compute a uint8_t using inverse integer scaling from the base integer type
     948             :  * used for bitfields.
     949             :  * \param value is the integer bitfield number to inverse scale
     950             :  * \param min is the minimum value that can be represented.
     951             :  * \param divisor is divided into the encoded integer to create the return value.
     952             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     953             :  */
     954           0 : uint8_t uint8ScaledFromBitfield(unsigned int value, int8_t min, uint8_t divisor)
     955             : {
     956           0 :     return (uint8_t)(min + value/divisor);
     957             : }
     958             : 
     959             : 
     960             : /*!
     961             :  * Decode a uint8_t from a byte stream by inverse integer scaling from 1
     962             :  * unsigned byte.
     963             :  * \param bytes is a pointer to the byte stream to decode.
     964             :  * \param index gives the location of the first byte in the byte stream, and
     965             :  *        will be incremented by 1 when this function is complete.
     966             :  * \param min is the minimum value that can be decoded.
     967             :  * \param divisor is divided into the encoded integer to create the return value.
     968             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     969             :  */
     970           0 : uint8_t uint8ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, int8_t min, uint8_t divisor)
     971             : {
     972           0 :     return (uint8_t)(min + uint8FromBytes(bytes, index)/divisor);
     973             : }
     974             : 
     975             : 
     976             : /*!
     977             :  * Decode a uint8_t from a byte stream by inverse integer scaling from 1 signed
     978             :  * byte.
     979             :  * \param bytes is a pointer to the byte stream to decode.
     980             :  * \param index gives the location of the first byte in the byte stream, and
     981             :  *        will be incremented by 1 when this function is complete.
     982             :  * \param divisor is divided into the encoded integer to create the return value.
     983             :  * \return the correctly scaled decoded value: return = encoded/divisor.
     984             :  */
     985           0 : uint8_t uint8ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, uint8_t divisor)
     986             : {
     987           0 :     return (uint8_t)(int8FromBytes(bytes, index)/divisor);
     988             : }
     989             : 
     990             : 
     991             : /*!
     992             :  * Compute a int8_t using inverse integer scaling from the base integer type
     993             :  * used for bitfields.
     994             :  * \param value is the integer bitfield number to inverse scale
     995             :  * \param min is the minimum value that can be represented.
     996             :  * \param divisor is divided into the encoded integer to create the return value.
     997             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
     998             :  */
     999           0 : int8_t int8ScaledFromBitfield(unsigned int value, int8_t min, uint8_t divisor)
    1000             : {
    1001           0 :     return (int8_t)(min + value/divisor);
    1002             : }
    1003             : 
    1004             : 
    1005             : /*!
    1006             :  * Decode a int8_t from a byte stream by inverse integer scaling from 1
    1007             :  * unsigned byte.
    1008             :  * \param bytes is a pointer to the byte stream to decode.
    1009             :  * \param index gives the location of the first byte in the byte stream, and
    1010             :  *        will be incremented by 1 when this function is complete.
    1011             :  * \param min is the minimum value that can be decoded.
    1012             :  * \param divisor is divided into the encoded integer to create the return value.
    1013             :  * \return the correctly scaled decoded value: return = min + encoded/divisor.
    1014             :  */
    1015           0 : int8_t int8ScaledFrom1UnsignedBytes(const uint8_t* bytes, int* index, int8_t min, uint8_t divisor)
    1016             : {
    1017           0 :     return (int8_t)(min + uint8FromBytes(bytes, index)/divisor);
    1018             : }
    1019             : 
    1020             : 
    1021             : /*!
    1022             :  * Decode a int8_t from a byte stream by inverse integer scaling from 1 signed
    1023             :  * byte.
    1024             :  * \param bytes is a pointer to the byte stream to decode.
    1025             :  * \param index gives the location of the first byte in the byte stream, and
    1026             :  *        will be incremented by 1 when this function is complete.
    1027             :  * \param divisor is divided into the encoded integer to create the return value.
    1028             :  * \return the correctly scaled decoded value: return = encoded/divisor.
    1029             :  */
    1030           0 : int8_t int8ScaledFrom1SignedBytes(const uint8_t* bytes, int* index, uint8_t divisor)
    1031             : {
    1032           0 :     return (int8_t)(int8FromBytes(bytes, index)/divisor);
    1033             : }
    1034             : 
    1035             : 
    1036             : // end of scaleddecode.c

Generated by: LCOV version 1.14