libsent/src/util/endian.c

Go to the documentation of this file.
00001 
00017 /*
00018  * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University
00019  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00020  * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology
00021  * All rights reserved
00022  */
00023 
00024 #include <sent/stddefs.h>
00025 
00033 void
00034 swap_bytes(char *buf, size_t unitbyte, int unitnum)
00035 {
00036   char *p, c;
00037   int i, j;
00038 
00039   p = buf;
00040   while (unitnum > 0) {
00041     i=0; j=unitbyte-1;
00042     while(i<j) {
00043       c = p[i]; p[i] = p[j]; p[j] = c;
00044       i++;j--;
00045     }
00046     p += unitbyte;
00047     unitnum--;
00048   }
00049 }
00050 
00057 void
00058 swap_sample_bytes(SP16 *buf, int len)
00059 {
00060   char *p;
00061   char t;
00062   int i;
00063   
00064   p = (char *)buf;
00065 
00066   for (i=0;i<len;i++) {
00067     t = *p;
00068     *p = *(p + 1);
00069     *(p + 1) = t;
00070     p += 2;
00071   }
00072 }

Generated on Tue Dec 26 16:16:33 2006 for Julius by  doxygen 1.5.0