Changeset 5dd874a in git


Ignore:
Timestamp:
26/07/10 10:55:17 (9 years ago)
Author:
Olly Betts <olly@…>
Branches:
add-show-splays, line_contents, master, stereo, svn/github/master, svn/origin/master, svn/tags/1.1.14, svn/tags/1.1.15, svn/tags/1.1.16, svn/tags/1.2.0, svn/tags/1.2.1, svn/tags/1.2.2, svn/tags/1.2.3, svn/tags/1.2.4, svn/tags/1.2.5, svn/trunk, travis-osx
Children:
9e12d78
Parents:
7e5d688
Message:

configure.in,src/useful.h: On little-endian architectures, make
get16() and get32() inline functions, rather than macros which use
a global variable.

git-svn-id: file:///home/survex-svn/survex/trunk@3501 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r7e5d688 r5dd874a  
     1Mon Jul 26 09:48:10 GMT 2010  Olly Betts <olly@survex.com>
     2
     3        * configure.in,src/useful.h: On little-endian architectures, make
     4          get16() and get32() inline functions, rather than macros which use
     5          a global variable.
     6
    17Mon Jul 26 09:31:14 GMT 2010  Olly Betts <olly@survex.com>
    28
  • configure.in

    r7e5d688 r5dd874a  
    9999
    100100AC_LANG_C
     101
     102AC_C_INLINE
    101103
    102104AC_PROG_MAKE_SET
  • src/useful.c

    r7e5d688 r5dd874a  
    2424#include "osdepend.h"
    2525
    26 #ifndef WORDS_BIGENDIAN
    27 
    28 /* used by macro versions of useful_get<nn> functions */
    29 int16_t useful_w16;
    30 int32_t useful_w32;
    31 
    32 #else
     26#ifdef WORDS_BIGENDIAN
    3327
    3428extern void Far
  • src/useful.h

    r7e5d688 r5dd874a  
    11/* useful.h
    22 * Lots of oddments that come in handy generally
    3  * Copyright (C) 1993-2003,2004 Olly Betts
     3 * Copyright (C) 1993-2003,2004,2010 Olly Betts
    44 *
    55 * This program is free software; you can redistribute it and/or modify
     
    118118
    119119#ifndef WORDS_BIGENDIAN
    120 extern int16_t useful_w16;
    121 extern int32_t useful_w32;
    122 
    123120# define put16(W, FH) BLK(int16_t w = (W); fwrite(&w, 2, 1, (FH));)
    124121# define put32(W, FH) BLK(int32_t w = (W); fwrite(&w, 4, 1, (FH));)
    125 # define get16(FH) (fread(&useful_w16, 2, 1, (FH)), useful_w16)
    126 # define get32(FH) (fread(&useful_w32, 4, 1, (FH)), useful_w32)
     122
     123static inline int16_t get16(FILE *fh) {
     124    int16_t w;
     125    fread(&w, 2, 1, fh);
     126    return w;
     127}
     128
     129static inline int32_t get32(FILE *fh) {
     130    int32_t w;
     131    fread(&w, 4, 1, fh);
     132    return w;
     133}
    127134#else
    128135/* FIXME: why are these "Far"? */
Note: See TracChangeset for help on using the changeset viewer.