Ignore:
Timestamp:
09/29/06 16:55:39 (18 years ago)
Author:
r2d
Message:
  • added libmpcenc and a common directory
  • can compile libmpcenc and libmpcpsy don't know about linking
Location:
mppenc/branches/r2d/libmpcenc
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • mppenc/branches/r2d/libmpcenc/tools.c

    r60 r64  
    3131#include <string.h>
    3232#include <errno.h>
    33 #include "mppdec.h"
    34 
     33#include <stdio.h>
     34
     35#include "libmpcenc.h"
    3536
    3637#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
     
    6061
    6162
    62 int
    63 isdir ( const char* Name )
    64 {
    65 #if FILEIO == 1
    66     return 1;
    67 #else
    68     STRUCT_STAT  st;
    69 
    70     if ( STAT_CMD ( Name, &st ) != 0 )
    71         return 0;
    72     return S_ISDIR ( st.st_mode );
    73 #endif
    74 }
    75 
    76 
    7763/*
    7864 *  Change_Endian32() changes the endianess of a 32-bit memory block in-place
     
    8672
    8773static void
    88 Change_Endian32 ( Uint32_t* dst, size_t words32bit )
     74Change_Endian32 ( mpc_uint32_t* dst, size_t words32bit )
    8975{
    9076
    9177    for ( ; words32bit--; dst++ ) {
    9278# if  INT_MAX >= 2147483647L
    93         Uint32_t  tmp = *dst;
     79        mpc_uint32_t  tmp = *dst;
    9480        tmp  = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
    9581        tmp  = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
    9682        *dst = tmp;
    9783# else
    98         Uint8_t  tmp;
    99         tmp                = ((Uint8_t*)dst)[0];
    100         ((Uint8_t*)dst)[0] = ((Uint8_t*)dst)[3];
    101         ((Uint8_t*)dst)[3] = tmp;
    102         tmp                = ((Uint8_t*)dst)[1];
    103         ((Uint8_t*)dst)[1] = ((Uint8_t*)dst)[2];
    104         ((Uint8_t*)dst)[2] = tmp;
     84        mpc_uint8_t  tmp;
     85        tmp                = ((mpc_uint8_t*)dst)[0];
     86        ((mpc_uint8_t*)dst)[0] = ((mpc_uint8_t*)dst)[3];
     87        ((mpc_uint8_t*)dst)[3] = tmp;
     88        tmp                = ((mpc_uint8_t*)dst)[1];
     89        ((mpc_uint8_t*)dst)[1] = ((mpc_uint8_t*)dst)[2];
     90        ((mpc_uint8_t*)dst)[2] = tmp;
    10591# endif
    10692    }
     
    119105
    120106size_t
    121 Read_LittleEndians ( FILE_T fp, Uint32_t* dst, size_t words32bit )
     107Read_LittleEndians ( FILE* fp, mpc_uint32_t* dst, size_t words32bit )
    122108{
    123109    size_t  wordsread;
     
    541527
    542528void
    543 Make_LookupTable ( Uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements )
     529Make_LookupTable ( mpc_uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements )
    544530{
    545531    size_t    i;
    546532    size_t    idx  = elements;
    547     Uint32_t  dval = (Uint32_t)0x80000000L / LUT_len * 2;
    548     Uint32_t  val  = dval - 1;
     533    mpc_uint32_t  dval = (mpc_uint32_t)0x80000000L / LUT_len * 2;
     534    mpc_uint32_t  val  = dval - 1;
    549535
    550536    for ( i = 0; i < LUT_len; i++, val += dval ) {
    551537        while ( idx > 0  &&  val >= Table[idx-1].Code )
    552538            idx--;
    553         *LUT++ = (Uint8_t)idx;
     539        *LUT++ = (mpc_uint8_t)idx;
    554540    }
    555541
     
    561547Init_FPU ( void )
    562548{
    563     Uint16_t  cw;
     549    mpc_uint16_t  cw;
    564550
    565551#if   defined __i386__  &&  defined _FPU_GETCW  &&  defined _FPU_SETCW
Note: See TracChangeset for help on using the changeset viewer.