summaryrefslogtreecommitdiff
path: root/lib/libc/string/swab.c
AgeCommit message (Collapse)Author
2022-12-28swab(3): Rewrite this to be understandable.riastradh
And make the tests work, and exercise all lengths up to 100. Evidently the previous definition, presumably tightly optimized for 1980s-era compilers and CPUs, was too hard to understand, because it was incorrectly tested for two decades and broken for years. PR lib/57141 XXX pullup-8 XXX pullup-9 XXX pullup-10
2022-12-28PR lib/57141 - never decrement len without actually performing a STEP.kre
2011-01-04Special-case the (unlikely in practice) call with len = 2 - previouslymartin
the code would not have swapped anything. Problem pointed out by sparc64 automatic test run.
2010-04-18The number of byte pairs to swap is len/2, not len/2+1.apb
2010-04-18Bitwise operations on signed types are well-defined if the valuesapb
happen to be positive, and indeed the values here were guaranteed to be positive, but some compilers complained anyway, so convert the bitwise operations to arithmetic operations.
2010-04-18simplifychristos
2010-04-17fix lintchristos
2010-04-17Change and document for POSIX compliance.christos
2003-08-07Move UCB-licensed code from 4-clause to 3-clause licence.agc
Patches provided by Joel Baker in PR 22280, verified by myself.
2001-05-22fix incorrect loop sentinel caused by previous de-linting.christos
2001-01-26ANSIfy and de-lint. Reviewed by christos.wiz
1999-09-20back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.lukem
_DIAGASSERT() is still retained.
1999-09-16* use _DIAGASSERT() to check pointer arguments against NULL and filelukem
descriptors against -1 (as appropriate). * add actual checks which to detect stuff that would trigger_DIAGASSERT(), and attempt to return a sane error condition. * knf some code * remove some `register' decls. the first two items result in the addition of code similar to the following in various functions: _DIAGASSERT(path != NULL) #ifdef _DIAGNOSTIC if (path == NULL) { errno = EFAULT; return (-1); } #endif
1998-02-03remove obsolete register declarationsperry
1998-01-30update to lite-2perry
1998-01-12Per XPG4, move the prototype of swab() from <string.h> to <unistd.h>.kleink
1997-07-13Fix RCSID'schristos
Use "extern.h" where appropriate.
1993-08-26Declare rcsid strings so they are stored in text segment.jtc
1993-08-01Add RCS identifiers.mycroft
1993-03-21initial import of 386bsd-0.1 sourcescgd