[CSOUND-DEV:5415] RFC: benlong()
Date | 2004-11-02 22:42 |
From | Ben Collver |
Subject | [CSOUND-DEV:5415] RFC: benlong() |
Attachments | None |
Date | 2004-11-03 08:22 |
From | jpff@codemist.co.uk |
Subject | [CSOUND-DEV:5416] Re: RFC: benlong() |
Are you referring to cs4 or cs5? I thought I had done that in cs5; perhaps I did not finish it -- but using portaudio/libsndfile stopped the details. Look at the cs5 Attic, but why change cs4 now? ==John ffitch |
Date | 2004-11-03 10:10 |
From | Ben Collver |
Subject | [CSOUND-DEV:5417] Re: RFC: benlong() |
Attachments | None |
Date | 2004-11-04 03:18 |
From | Ben Collver |
Subject | [CSOUND-DEV:5418] Re: RFC: benlong() |
Attachments | None |
Date | 2004-11-17 00:00 |
From | Ben Collver |
Subject | [CSOUND-DEV:5441] ping John Ffitch |
Attachments | None |
Date | 2004-11-18 17:04 |
From | Anthony Kozar |
Subject | [CSOUND-DEV:5446] Re: RFC: benlong() |
Ben, Since you do not seem to have gotten any other responses, I thought I would weigh in with my opinion (which may not mean much as I am by no means an expert on any of this :). On 11/2/04 5:42 PM, Ben Collver |
Date | 2004-11-18 17:07 |
From | Anthony Kozar |
Subject | [CSOUND-DEV:5447] Re: RFC: benlong() |
I would definitely only attempt the 64-bit clean mods with CS5. (Just my opinion though). The benlong() stuff though would be up to you. (I am using Cs4 and I am on a big-endian system too :) Anthony Kozar anthony.kozar@utoledo.edu http://akozar.spymac.net/ On 11/3/04 10:18 PM, Ben Collver |
Date | 2004-11-18 17:29 |
From | Richard Dobson |
Subject | [CSOUND-DEV:5448] Re: RFC: benlong() |
Note that as an alternative to a forest of #ifdefs, it can all be done programmatically. I got this from the SNDAN sources (I use in pvfileio.c for reading PVOC_EX files), and don't see why it wouldn't work just as effectively with a 64bit int: static int byte_order() { int one = 1; char* endptr = (char *) &one; return (*endptr); } e.g: int is_little_endian = byte_order(); Richard Dobson Anthony Kozar wrote: > I would definitely only attempt the 64-bit clean mods with CS5. (Just my > opinion though). The benlong() stuff though would be up to you. (I am > using Cs4 and I am on a big-endian system too :) > > Anthony Kozar > anthony.kozar@utoledo.edu > http://akozar.spymac.net/ > > On 11/3/04 10:18 PM, Ben Collver |
Date | 2004-11-18 17:50 |
From | Ben Collver |
Subject | [CSOUND-DEV:5449] Re: RFC: benlong() |
Attachments | None |
Date | 2004-11-18 17:57 |
From | Ben Collver |
Subject | [CSOUND-DEV:5450] Re: RFC: benlong() |
Attachments | None |
Date | 2004-11-18 18:19 |
From | Richard Dobson |
Subject | [CSOUND-DEV:5451] Re: RFC: benlong() |
The build-time approach does in theory offer greater efficiency by avoiding the if test, at the cost of lots of #ifdefs. Of course, if this difference is significant (typically it will be dwarfed by the overhead of disk i/o), we will want the faster system. Advantages of the programmatic apprach are: (a) arguably tidier-looking than #ifdefs; can be useful in debugging (b) for code not exclusive to Csound (such as pvfileio), one is not tied to a particular preprocessor symbol. If I had used say #ifndef LITTLE_ENDIAN .... #else ... #endif Either my code would have to be changed to use to new symbol, or that symbol would have to be added to the compiler list, one way or another. Also (in situations where autoconf cannot be relied upon or isn't being used), this approach ~relies~ on the symbol being defined, or on being correctly undefined. A fully robust solution is to require that either WORDS_BIGENDIAN or WORDS_LITTLE_ENDIAN must be defined, or the compiler will report an error. This is because it is meaningless to "default" to a certain byte-order; it ~must~ be one or the other! Richard Dobson Ben Collver wrote: > That is an interesting idea to detect the byte order at run-time instead > of build-time. However, the build system (autoconf) is already checking > it before build-time. > > Why is > if (is_little_endian) { > ... > } > better than > #ifndef WORDS_BIGENDIAN > ... > #endif > ? > > Cheers, > > Ben > > On Thu, Nov 18, 2004 at 05:29:47PM +0000, Richard Dobson wrote: > >>Note that as an alternative to a forest of #ifdefs, it can all be done >>programmatically. I got this from the SNDAN sources (I use in pvfileio.c >>for reading PVOC_EX files), and don't see why it wouldn't work just as >>effectively with a 64bit int: >> >>static int byte_order() >>{ >> int one = 1; >> char* endptr = (char *) &one; >> return (*endptr); >>} >> >>e.g: >> >>int is_little_endian = byte_order(); >> >>Richard Dobson > > > > |
Date | 2004-11-18 18:39 |
From | Ben Collver |
Subject | [CSOUND-DEV:5452] Re: RFC: benlong() |
Attachments | None |
Date | 2004-11-18 19:18 |
From | John ffitch |
Subject | [CSOUND-DEV:5453] Re: RFC: benlong() |
Csound 5 find . -type f -print | xargs egrep -l '^long (ben|nat)long' ./Opcodes/natben.c ./Top/natben.c ./util1/scot/scot_main.c ./util1/scot/main.c ./util1/sortex/smain.c ./strings/makedb.c |