1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-16 18:08:04 +00:00
Commit Graph

468 Commits

Author SHA1 Message Date
Colin Leroy-Mira
1fab179cb4 a BIT of 65C02 optimisations
Use BIT immediate instead of AND when reloading A is required
afterwards.
Add an fread unit test as the optimisation touches fread.
Sprinkle a few zero page indexed while we're at it.
2024-02-02 19:45:49 +01:00
Colin Leroy-Mira
afd8ee627e Remove useless branching code in fgets 2024-01-30 19:52:48 +01:00
Colin Leroy-Mira
2b97735d5d Factorize file pointer check 2024-01-30 19:40:28 +01:00
Colin Leroy-Mira
1a5a7d67a7 Rewrite fputc in assembly
-36 bytes, -12% cycles
2024-01-30 17:19:13 +01:00
Colin Leroy-Mira
ba36071022 Rewrite fputs in assembly
-28 bytes, -1% cycles
2024-01-30 17:12:52 +01:00
Bob Andrews
8682095f9f
Merge pull request #2384 from colinleroy/asm-realloc
Rewrite realloc in asm
2024-01-27 00:28:17 +01:00
Colin Leroy-Mira
aa6f850b8d Rewrite gets in assembler
+19 bytes if used alone, because it pulls in fgets, but as code is
factorized, -128 bytes in programs using both fgets and gets.
2024-01-26 20:29:17 +01:00
Colin Leroy-Mira
a8b870555e Rewrite realloc in asm
-80 bytes, -39% cycles
2024-01-26 20:25:59 +01:00
Bob Andrews
65937684a0
Merge pull request #2380 from colinleroy/asm-fgetc
Rewrite fgetc in asm
2024-01-26 20:12:41 +01:00
Bob Andrews
ba6f9f5d3f
Merge pull request #2381 from colinleroy/asm-fgets
Rewrite fgets in asm
2024-01-26 19:36:57 +01:00
Colin Leroy-Mira
476591e8b7 Rewrite fgetc in asm
-82 bytes, -20% cycles
2024-01-25 09:13:39 +01:00
Bob Andrews
ee3a542539
Merge pull request #2383 from colinleroy/pmemalign-size-opt
Optimize -36 bytes out of posix_memalign
2024-01-24 21:26:50 +01:00
Bob Andrews
9ba270d97b
Merge pull request #2378 from colinleroy/fix-overflow-in-malloc-and-realloc
Fix malloc and realloc overflow
2024-01-24 21:15:31 +01:00
Colin Leroy-Mira
b87df9e1c6 Optimize -36 bytes out of posix_memalign
And add a unit test
2024-01-24 10:23:53 +01:00
Colin Leroy-Mira
1f820d0ae8 Rewrite fgets in asm
-104 bytes, -1% cycles
2024-01-24 10:16:26 +01:00
Colin Leroy-Mira
5d49fde788 add a return -1 helper 2024-01-24 09:58:09 +01:00
Colin Leroy-Mira
3e01ac9b04 Fix malloc and realloc overflow
If user requests a size >= 65532, adding the heap admin size
overflows size. Fixes #2358.
2024-01-24 09:54:54 +01:00
Colin Leroy-Mira
10282a9b74 Rewrite asctime() in assembler (-7 bytes) 2024-01-18 09:09:38 +01:00
Colin Leroy-Mira
03d5e5fba0 Rewrite mktime in assembly
-415 bytes,
-39% cycles,
Unit test expanded to cover more cases (there was a bug in 2100 before!)
2024-01-18 09:09:38 +01:00
Colin Leroy-Mira
348a9048b7 Convert _time_t_to_tm to asm
46 bytes size gain, -8% cycles on the unit tests
2024-01-18 09:09:31 +01:00
Bob Andrews
2127778239
Merge pull request #2336 from colinleroy/optimize-strdup
Optimize strdup
2024-01-08 22:13:43 +01:00
Colin Leroy-Mira
df193c0947 Rework time functions a bit
- mktime: Work unsigned as time_t's type implies (shifting Y2K38 bug to 2106)
- mktime: Add unit tests
- gmtime/localtime: factorize
- gmtime/localtime: Add unit tests
- mktime/gmtime/localtime: Size optimisation (-130 bytes wrt master)
- mktime: Speed optimisation (from 23M cycles on the unit test to 2M)
2024-01-08 18:24:13 +01:00
Colin Leroy-Mira
3a439e0e1b Little strdup optimisation
-12 bytes on disk
-20 cycles per strdup
-6 cycles per strlen called from strdup
2024-01-07 14:25:06 +01:00
Colin Leroy-Mira
a90aa57510 Address Oliver's comments 2023-09-07 16:48:56 +02:00
Colin Leroy-Mira
dfe7562f76 Add ntohs, htons, ntohl, htons. 2023-09-07 07:03:34 +02:00
Christian Groessler
fedfc3443d fix for issue #1973 (printf("%c", '\0') doesn't _write '\0' to fd 0) 2023-02-24 02:12:19 +01:00
mrdudz
5bda57de87 add extra underscore to _bzero, add a test for bzero/memset 2022-08-29 23:20:48 +02:00
mrdudz
3b03a96375 add underscores to _poserror and _stroserror 2022-08-29 21:06:48 +02:00
mrdudz
89c08dc6d4 extra underscores for _randomize and _swap 2022-08-29 20:52:35 +02:00
mrdudz
b09024aa32 add extra underscore to heap stuff 2022-08-29 19:55:48 +02:00
mrdudz
df4b6f9d14 remove extra spaces 2022-08-28 22:37:33 +02:00
mrdudz
54aff47513 fix some errno related stuff, "make all" works again 2022-08-28 22:09:44 +02:00
mrdudz
2dabb65ee0 fix errno related underscores in all libsrc/*.s files 2022-08-28 21:52:53 +02:00
mrdudz
f70020a2b8 use __sig_ign and __sig_dft instead of _sig_ign and _sig_dft 2022-08-28 20:18:34 +02:00
mrdudz
9246775ebe use __afailed instead of _afailed 2022-08-28 20:08:13 +02:00
mrdudz
8e5f6b822d fix setjmp.h 2022-08-28 20:05:11 +02:00
polluks2
7a93d3c707
Shorter isascii 2022-08-04 00:25:04 +02:00
Bob Andrews
6239fbe18c
Revert "rename '_poserror' to '__poserror'" 2022-07-24 18:14:21 +02:00
Christian Groessler
758d9466c0 rename '_poserror' to '__poserror'
The old name could be non-conforming to the C standard. The new name
is definitely in the "implementation name space".

See issue #1796.
2022-07-24 00:33:56 +02:00
mrdudz
16bf472e66 reserve enough space for the longest string we can expect 2022-07-13 23:10:19 +02:00
mrdudz
f8f901b05e remove dangling spaces 2022-04-17 16:06:22 +02:00
Jeff Tranter
2bf8be5b3b Fix some commonly made spelling errors in comments. 2022-02-21 15:44:31 -05:00
Sven Michael Klose
0b84465276 Fix strnlen(). 2021-12-25 09:11:58 +01:00
Sven Michael Klose
921e549172 Add standard C library function strnlen(). 2021-12-24 23:44:57 +01:00
Greg King
884f72637b Put the alignment decrement code back into posix_memalign().
Without that code, the function returns a very broken pointer.
2021-12-19 21:08:46 -05:00
Oliver Schmidt
2235830e31 Don't rely on (actually changed) unspecified compiler behavior. 2021-12-19 16:55:32 +01:00
Andrea Odetti
05f545e189 More line number related changes. 2021-05-11 17:41:59 +02:00
Polluks
4c37f12a4d Optimised strlen 2021-05-08 19:36:37 +02:00
Greg King
216bb22b20 Added a special version of a function which uses an absolute addressing mode to access the zero page.
The PCEngine needs such operands to be redirected to RAM page $20 explicitly.  Fixes #1482; fixes #1483.
2021-05-04 12:10:43 -04:00
Oliver Schmidt
5d84a4ba13 Removed non-ASCII chars. 2021-04-19 16:06:10 +02:00