~ubuntu-branches/debian/sid/upx-ucl/sid

« back to all changes in this revision

Viewing changes to src/util.h

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2006-06-13 21:23:23 UTC
  • mfrom: (1.3.1 upstream) (3.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20060613212323-343yzs4jt6vr5483
* New upstream version.
* Standards-Version: 3.7.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
int find(const void *b, int blen, const void *what, int wlen);
54
54
int find_be16(const void *b, int blen, unsigned what);
55
55
int find_be32(const void *b, int blen, unsigned what);
 
56
int find_be64(const void *b, int blen, acc_uint64l_t what);
56
57
int find_le16(const void *b, int blen, unsigned what);
57
58
int find_le32(const void *b, int blen, unsigned what);
58
 
 
59
 
#if (UPX_VERSION_HEX < 0x019000)
60
 
upx_bytep pfind(const void *b, int blen, const void *what, int wlen);
61
 
upx_bytep pfind_be16(const void *b, int blen, unsigned what);
62
 
upx_bytep pfind_be32(const void *b, int blen, unsigned what);
63
 
upx_bytep pfind_le16(const void *b, int blen, unsigned what);
64
 
upx_bytep pfind_le32(const void *b, int blen, unsigned what);
 
59
int find_le64(const void *b, int blen, acc_uint64l_t what);
 
60
 
 
61
int mem_replace(void *b, int blen, const void *what, int wlen, const void *r);
 
62
 
 
63
 
 
64
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530))
 
65
#elif (ACC_CC_DMC && (__DMC__ < 0x830))
 
66
#elif (ACC_CC_MSC && (_MSC_VER < 1310))
 
67
#else
 
68
template <class T>
 
69
inline int ptr_diff(const T *p1, const T *p2)
 
70
{
 
71
    COMPILE_TIME_ASSERT(sizeof(T) == 1)
 
72
    ptrdiff_t d = (const char*) p1 - (const char*) p2;
 
73
    assert((int)d == d);
 
74
    return (int) d;
 
75
}
65
76
#endif
66
 
 
67
 
 
68
 
inline ptrdiff_t ptr_diff(const void *p1, const void *p2)
 
77
inline int ptr_diff(const void *p1, const void *p2)
69
78
{
70
 
    return (const char*) p1 - (const char*) p2;
 
79
    ptrdiff_t d = (const char*) p1 - (const char*) p2;
 
80
    assert((int)d == d);
 
81
    return (int) d;
71
82
}
72
83
 
73
84