aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index ebbb99c775bd..198148bb61fd 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -723,6 +723,72 @@ void memzero_explicit(void *s, size_t count)
723} 723}
724EXPORT_SYMBOL(memzero_explicit); 724EXPORT_SYMBOL(memzero_explicit);
725 725
726#ifndef __HAVE_ARCH_MEMSET16
727/**
728 * memset16() - Fill a memory area with a uint16_t
729 * @s: Pointer to the start of the area.
730 * @v: The value to fill the area with
731 * @count: The number of values to store
732 *
733 * Differs from memset() in that it fills with a uint16_t instead
734 * of a byte. Remember that @count is the number of uint16_ts to
735 * store, not the number of bytes.
736 */
737void *memset16(uint16_t *s, uint16_t v, size_t count)
738{
739 uint16_t *xs = s;
740
741 while (count--)
742 *xs++ = v;
743 return s;
744}
745EXPORT_SYMBOL(memset16);
746#endif
747
748#ifndef __HAVE_ARCH_MEMSET32
749/**
750 * memset32() - Fill a memory area with a uint32_t
751 * @s: Pointer to the start of the area.
752 * @v: The value to fill the area with
753 * @count: The number of values to store
754 *
755 * Differs from memset() in that it fills with a uint32_t instead
756 * of a byte. Remember that @count is the number of uint32_ts to
757 * store, not the number of bytes.
758 */
759void *memset32(uint32_t *s, uint32_t v, size_t count)
760{
761 uint32_t *xs = s;
762
763 while (count--)
764 *xs++ = v;
765 return s;
766}
767EXPORT_SYMBOL(memset32);
768#endif
769
770#ifndef __HAVE_ARCH_MEMSET64
771/**
772 * memset64() - Fill a memory area with a uint64_t
773 * @s: Pointer to the start of the area.
774 * @v: The value to fill the area with
775 * @count: The number of values to store
776 *
777 * Differs from memset() in that it fills with a uint64_t instead
778 * of a byte. Remember that @count is the number of uint64_ts to
779 * store, not the number of bytes.
780 */
781void *memset64(uint64_t *s, uint64_t v, size_t count)
782{
783 uint64_t *xs = s;
784
785 while (count--)
786 *xs++ = v;
787 return s;
788}
789EXPORT_SYMBOL(memset64);
790#endif
791
726#ifndef __HAVE_ARCH_MEMCPY 792#ifndef __HAVE_ARCH_MEMCPY
727/** 793/**
728 * memcpy - Copy one area of memory to another 794 * memcpy - Copy one area of memory to another