Commit Graph

10 Commits

Author SHA1 Message Date
H. Peter Anvin
e76a626055 Replace unchecked fwrite() calls
Instead of having unchecked fwrite() calls, introduce nasm_write()
which does error checking (and fatal errors if the write fails).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-10-21 12:50:47 -07:00
Cyrill Gorcunov
0aa9bdf7b2 Fix saa_writeaddr for big-endian case
saa_writeaddr on big-endian archs didn't write converted
argument, fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2011-07-17 13:59:13 +04:00
H. Peter Anvin
9bd1506d59 Remove function pointers in output, simplify error handling
Remove a bunch of function pointers in the output stage; they are
never changed and don't add any value.  Also make "ofile" a global
variable and let the backend use it directly.

All we ever did with these variables were stashing it in locals and
using them as-is anyway for no benefit.

Also change the global error function, nasm_error() into a true
function which invokes a function pointer internally.  That lets us
use direct calls to it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-18 18:43:12 -07:00
H. Peter Anvin
9e6747ccac Add copyright headers to the *.c/*.h files in the main directory
Add copyright headers to the *.c/*.h files in the main directory.  For
files where I'm sure enough that we have all the approvals, I have
given them the 2-BSD license, the others have been given the "LGPL for
now" license header.  Most of them can probably be changed after
auditing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28 17:13:04 -07:00
H. Peter Anvin
edb58f7813 SAA: add saa_writeaddr() similar to other locations
Provide saa_writeaddr() to write an integer in x86 format.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 19:30:34 -07:00
H. Peter Anvin
3c7e6b396f saa: fix indentation
Apply standard indentation to the SAA code, not sure why it was
different...
2008-06-19 23:09:11 -07:00
H. Peter Anvin
51997d3d44 Introduce likely/unlikely macros, use them in saa.c
Introduce the likely() and unlikely() macros, as used in Linux.
They are compiler-dependent hints that a particular boolean expression
is likely to be true or false, respectively.

Currently only implemented for gcc.
2008-06-10 09:35:26 -07:00
H. Peter Anvin
8cc5aa7829 SAA: optimize all power-of-two lengths
We can actually use the shift optimization whenever blk_len ==
SAA_BLKLEN, which will be true for all powers of two.
2008-06-10 09:31:31 -07:00
H. Peter Anvin
1cff81e356 SAA: optimize seeks when used on a byte array
In practice, we only ever use the seeking functions on byte arrays
(elem_len == 1).  Optimize for that case, to avoid a general divmod
operation.
2008-06-10 09:29:20 -07:00
H. Peter Anvin
1803dedae8 Move all the SAA code out of nasmlib
Move all the SAA code out of nasmlib; it's not used by anything than
nasm itself.  Cleaning out the kitchen sink known as nasmlib is a good
thing, too.
2008-06-09 17:32:43 -07:00