aboutsummaryrefslogtreecommitdiff
path: root/lib/stdlib/mem.c
AgeCommit message (Collapse)Author
2018-08-03Create a library file for libcRoberto Vargas
TF Makefile was linking all the objects files generated for the c library instead of creating a static library that could be used in the linking stage. Change-Id: I721daea097e9b13cbb42c9f8eaa2af8fea0799cf Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-05-03Use SPDX license identifiersdp-arm
To make software license auditing simpler, use SPDX[0] license identifiers instead of duplicating the license text in every file. NOTE: Files that have been imported by FreeBSD have not been modified. [0]: https://spdx.org/ Change-Id: I80a00e1f641b8cc075ca5a95b10607ed9ed8761a Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2016-12-13stdlib: Fix signedness issue in memcmp()dp-arm
There is no guarantee on the signedness of char. It can be either signed or unsigned. On ARM it is unsigned and hence this memcmp() implementation works as intended. On other machines, char can be signed (x86 for example). In that case (and assuming a 2's complement implementation), interpreting a bit-pattern of 0xFF as signed char can yield -1. If *s1 is 0 and *s2 is 255 then the difference *s1 - *s2 should be negative. The C integer promotion rules guarantee that the unsigned chars will be converted to int before the operation takes place. The current implementation will return a positive value (0 - (-1)) instead, which is wrong. Fix it by changing the signedness to unsigned to avoid surprises for anyone using this code on non-ARM systems. Change-Id: Ie222fcaa7c0c4272d7a521a6f2f51995fd5130cc Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2014-01-30Fix memmove and memcpyJon Medhurst
memmove needs to allow for overlapping memory regions and, together with memcpy, should return the input destination pointer, not the address after the end of the copied data. fixes ARM-software/tf-issues#18 Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-17Update year in copyright text to 2014Dan Handley
Change-Id: Ic7fb61aabae1d515b9e6baf3dd003807ff42da60
2013-12-20Create local C library implementation (1/2)Harry Liebel
- This change is split into two separate patches in order to simplify the history as interpreted by 'git'. The split is between the move/rename and addition of new files. - Remove dependency on toolchain C library headers and functions in order to ensure behavioural compatibility between toolchains. - Use FreeBSD as reference for C library implementation. - Do not let GCC use default library include paths. - Remove unused definitions in modified headers and implementations. - Move C library files to 'lib/stdlib' and 'include/stdlib'. - Break std.c functions out into separate files. Change-Id: I91cddfb3229775f770ad781589670c57d347a154