##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.11A/W32               20/Jul/2004  18:58:52 #
# Copyright 1999-2004 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  arm                                                  #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  C:\medusa\charconv.c                                 #
#    Command line    =  -I "C:\Program Files\IAR Systems\Embedded Workbench  #
#                       4.0\ARM\INC\" -lc C:\medusa\Debug\List\ -la          #
#                       C:\medusa\Debug\List\ -o C:\medusa\Debug\Obj\ -s2    #
#                       --no_cse --no_unroll --no_inline --no_code_motion    #
#                       --no_tbaa --no_clustering --no_scheduling --debug    #
#                       --cpu_mode arm --endian little --cpu ARM7TDMI-S      #
#                       --stack_align 4 -e --fpu None                        #
#                       "-D_DLIB_CONFIG_FILE=C:\Program Files\IAR            #
#                       Systems\Embedded Workbench                           #
#                       4.0\ARM\LIB\dl4tpannl8n.h" C:\medusa\charconv.c      #
#    List file       =  C:\medusa\Debug\List\charconv.lst                    #
#    Object file     =  C:\medusa\Debug\Obj\charconv.r79                     #
#                                                                            #
#                                                                            #
##############################################################################

C:\medusa\charconv.c
      1          #include "archinc.h"
      2          #include "charconv.h"
      3          
      4          #ifdef CONFIG_INCLUDE_CHARCONV
      5          
      6          int charconvFromFloat32(float inFloat32, char * pOutBytes, int numBytes)
      7          {
      8            int i;
      9            union {
     10              float f;
     11              char ch[sizeof(float)];
     12              } u;
     13              
     14            u.f = inFloat32;
     15            
     16            for(i=0;i<sizeof(float);i++,pOutBytes++)
     17              *pOutBytes = u.ch[i];
     18          
     19            return 0;
     20          }
     21          
     22          int charconvFromSInt32(signed long int inSInt32, char * pOutBytes, int numBytes)
     23          {
     24            int i;
     25            union {
     26              signed long int sint;
     27              char ch[sizeof(signed long int)];
     28              } u;
     29              
     30            u.sint = inSInt32;
     31            
     32            for(i=0;i<sizeof(signed long int);i++,pOutBytes++)
     33              *pOutBytes = u.ch[i];
     34          
     35            return 0;
     36          }
     37          
     38          int charconvFromSInt16(signed short int inSInt16, char * pOutBytes, int numBytes)
     39          {
     40            int i;
     41            union {
     42              signed short int ssint;
     43              char ch[sizeof(signed short int)];
     44              } u;
     45              
     46            u.ssint = inSInt16;
     47            
     48            for(i=0;i<sizeof(signed short int);i++,pOutBytes++)
     49              *pOutBytes = u.ch[i];
     50          
     51            return 0;
     52          }
     53          
     54          int charconvFromSInt8(signed char inSInt8, char * pOutBytes, int numBytes)
     55          {
     56            *pOutBytes = inSInt8;
     57            return 0;
     58          }
     59          
     60          int charconvFromUInt32(unsigned long int inUInt32, char * pOutBytes, int numBytes)
     61          {
     62            int i;
     63            union {
     64              unsigned long int ulint;
     65              char ch[sizeof(unsigned long int)];
     66              } u;
     67              
     68            u.ulint = inUInt32;
     69            
     70            for(i=0;i<sizeof(unsigned long int);i++,pOutBytes++)
     71              *pOutBytes = u.ch[i];
     72          
     73            return 0;
     74          }
     75          
     76          int charconvFromUInt16(unsigned short int inUInt16, char * pOutBytes, int numBytes)
     77          {
     78            int i;
     79            union {
     80              unsigned short int usint;
     81              char ch[sizeof(unsigned short int)];
     82              } u;
     83              
     84            u.usint = inUInt16;
     85            
     86            for(i=0;i<sizeof(signed short int);i++,pOutBytes++)
     87              *pOutBytes = u.ch[i];
     88          
     89            return 0;
     90          }
     91          
     92          int charconvFromUInt8(unsigned char inUInt8, char * pOutBytes, int numBytes)
     93          {
     94            *pOutBytes = (char)inUInt8;
     95            return 0;
     96          }
     97          
     98          int charconvFromBoolean(boolean inBool, char * pOutBytes, int numBytes)
     99          {
    100            if (inBool == true)
    101              *pOutBytes = 1;
    102            else
    103              *pOutBytes = 0;
    104          
    105            return 0;
    106          }
    107          
    108          int charconvToFloat32(float * pOutFloat32, char * pInBytes, int numBytes)
    109          {
    110            int i;
    111            union {
    112              float f;
    113              char ch[sizeof(float)];
    114              } u;
    115              
    116            for(i=0;i<sizeof(float);i++,pInBytes++)
    117              u.ch[i] = *pInBytes;
    118          
    119            *pOutFloat32 = u.f;
    120            
    121            return 0;
    122          }
    123          
    124          int charconvToSInt32(signed long int * pOutSInt32, char * pInBytes, int numBytes)
    125          {
    126            int i;
    127            union {
    128              signed long int sli;
    129              char ch[sizeof(signed long int)];
    130              } u;
    131              
    132            for(i=0;i<sizeof(signed long int);i++,pInBytes++)
    133              u.ch[i] = *pInBytes;
    134          
    135            *pOutSInt32 = u.sli;
    136            
    137            return 0;
    138          }
    139          
    140          int charconvToSInt16(signed short int * pOutSInt16, char * pInBytes, int numBytes)
    141          {
    142            int i;
    143            union {
    144              signed short int ssi;
    145              char ch[sizeof(signed short int)];
    146              } u;
    147              
    148            for(i=0;i<sizeof(signed short int);i++,pInBytes++)
    149              u.ch[i] = *pInBytes;
    150          
    151            *pOutSInt16 = u.ssi;
    152            
    153            return 0;
    154          }
    155          
    156          int charconvToSInt8(signed char * pOutSInt8, char * pInBytes, int numBytes)
    157          {
    158            *pOutSInt8 = *pInBytes;
    159            return 0;
    160          }
    161          
    162          int charconvToUInt32(unsigned long int * pOutUInt32, char * pInBytes, int numBytes)
    163          {
    164            int i;
    165            union {
    166              unsigned long int uli;
    167              char ch[sizeof(unsigned long int)];
    168              } u;
    169              
    170            for(i=0;i<sizeof(unsigned long int);i++,pInBytes++)
    171              u.ch[i] = *pInBytes;
    172          
    173            *pOutUInt32 = u.uli;
    174            
    175            return 0;
    176          }
    177          
    178          int charconvToUInt16(unsigned short int * pOutUInt16, char * pInBytes, int numBytes)
    179          {
    180            int i;
    181            union {
    182              unsigned short int usi;
    183              char ch[sizeof(unsigned short int)];
    184              } u;
    185              
    186            for(i=0;i<sizeof(unsigned short int);i++,pInBytes++)
    187              u.ch[i] = *pInBytes;
    188          
    189            *pOutUInt16 = u.usi;
    190            
    191            return 0;
    192          }
    193          
    194          int charconvToUInt8(unsigned char * pOutUInt8, char * pInBytes, int numBytes)
    195          {
    196            *pOutUInt8 = *pInBytes;
    197            return 0;
    198          }
    199          
    200          int charconvToBoolean(boolean * pOutBool, char * pInBytes, int numBytes)
    201          {
    202            if (*pInBytes != 0)
    203              *pOutBool = true;
    204            else
    205              *pOutBool = false;
    206          
    207            return 0;
    208          }
    209          
    210          #endif /* CONFIG_INCLUDE_CHARCONV */
    211          


   Segment part sizes:

     Function/Label Bytes
     -------------- -----

 
 
 0 bytes of memory

Errors: none
Warnings: none
