This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 364 for ps


Ignore:
Timestamp:
06/02/04 18:59:12 (21 years ago)
Author:
janwas
Message:

no message

Location:
ps/trunk/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/graphics/ObjectEntry.cpp

    r322 r364  
    1414
    1515// Gee's custom error handler
    16 #include <ps/XercesErrorHandler.h>
     16#include "ps/XercesErrorHandler.h"
    1717
    1818#ifdef _MSC_VER
  • ps/trunk/source/lib/lib.cpp

    r350 r364  
    2020#include "lib.h"
    2121
     22#include "sdl.h"    // endian functions
     23
    2224
    2325// more powerful atexit, with 0 or 1 parameters.
     
    292294    }
    293295
    294     int l = round(in * 255.0);
     296    int l = (int)(in * 255.0);
    295297    assert((unsigned int)l <= 255);
    296298    return (u8)l;
     
    307309    }
    308310
    309     long l = round(in * 65535.0);
     311    long l = (long)(in * 65535.0);
    310312    assert((unsigned long)l <= 65535);
    311313    return (u16)l;
    312314}
    313315
     316
     317
     318
     319
     320inline u16 read_le16(const void* p)
     321{
     322#if SDL_BYTE_ORDER == SDL_BIG_ENDIAN
     323    const u8* _p = (const u8*)p;
     324    return (u16)_p[0] | (u16)_p[1] << 8;
     325#else
     326    return *(u16*)p;
     327#endif
     328}
     329
     330
     331inline u32 read_le32(const void* p)
     332{
     333#if SDL_BYTE_ORDER == SDL_BIG_ENDIAN
     334    return SDL_Swap32(*(u32*)p);
     335#else
     336    return *(u32*)p;
     337#endif
     338}
    314339
    315340
  • ps/trunk/source/lib/lib.h

    r349 r364  
    200200inline int atexit2(void (*func)())
    201201{
    202     atexit2((void *)func);
     202    return atexit2((void *)func);
    203203}
    204204
     
    239239
    240240
    241 
    242 
    243 static inline u16 read_le16(const void* p)
    244 {
    245 #if __BYTE_ORDER == __BIG_ENDIAN
    246     const u8* _p = (const u8*)p;
    247     return (u16)_p[0] | (u16)_p[1] << 8;
    248 #else
    249     return *(u16*)p;
    250 #endif
    251 }
    252 
    253 
    254 static inline u32 read_le32(const void* p)
    255 {
    256 #if __BYTE_ORDER == __BIG_ENDIAN
    257     u32 t = 0;
    258     for(int i = 0; i < 4; i++)
    259     {
    260         t <<= 8;
    261         t |= *((const u8*)p)++;
    262     }
    263     return t;
    264 #else
    265     return *(u32*)p;
    266 #endif
    267 }
     241extern u16 read_le16(const void* p);
     242extern u32 read_le32(const void* p);
    268243
    269244
Note: See TracChangeset for help on using the changeset viewer.