summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/voicefont.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/tools/voicefont.c b/tools/voicefont.c
index df2577b455..546d0052f4 100644
--- a/tools/voicefont.c
+++ b/tools/voicefont.c
@@ -33,11 +33,9 @@
/* endian conversion macros */
#if defined(__BIG_ENDIAN__)
-#define SWAP2(x) (x)
-#define SWAP4(x) (x)
+#define UINT_TO_BE(x) (x)
#else
-#define SWAP2(x) ((((unsigned)(x)>>8) & 0x00ff) | (((unsigned)(x)<<8) & 0xff00))
-#define SWAP4(x) ((((unsigned)(x)>>24) & 0x000000ff) |\
+#define UINT_TO_BE(x) ((((unsigned)(x)>>24) & 0x000000ff) |\
(((unsigned)(x)>>8) & 0x0000ff00) |\
(((unsigned)(x)<<8) & 0x00ff0000) |\
(((unsigned)(x)<<24) & 0xff000000))
@@ -163,24 +161,24 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output)
/* Create the file format: */
/* 1st 32 bit value in the file is the version number */
- value = SWAP4(400); /* 4.00 */
+ value = UINT_TO_BE(400); /* 4.00 */
fwrite(&value, sizeof(value), 1, output);
/* 2nd 32 bit value in the file is the id number for the target
we made the voce file for */
- value = SWAP4(targetnum);
+ value = UINT_TO_BE(targetnum);
fwrite(&value, sizeof(value), 1, output);
/* 3rd 32 bit value in the file is the header size (= 1st table position) */
- value = SWAP4(HEADER_SIZE); /* version, target id, header size, number1, number2 */
+ value = UINT_TO_BE(HEADER_SIZE); /* version, target id, header size, number1, number2 */
fwrite(&value, sizeof(value), 1, output);
/* 4th 32 bit value in the file is the number of clips in 1st table */
- value = SWAP4(count-count_voiceonly);
+ value = UINT_TO_BE(count-count_voiceonly);
fwrite(&value, sizeof(value), 1, output);
/* 5th bit value in the file is the number of clips in 2nd table */
- value = SWAP4(count_voiceonly);
+ value = UINT_TO_BE(count_voiceonly);
fwrite(&value, sizeof(value), 1, output);
/* then followed by offset/size pairs for each clip */
@@ -199,9 +197,9 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output)
continue;
}
- value = SWAP4(pos[i]); /* position */
+ value = UINT_TO_BE(pos[i]); /* position */
fwrite(&value, sizeof(value), 1,output);
- value = SWAP4(size[i]); /* size */
+ value = UINT_TO_BE(size[i]); /* size */
fwrite(&value, sizeof(value), 1, output);
} /* for i */
} /* for j */