mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 04:27:41 +00:00
b=856850 add PodMove r=Waldo
--HG-- extra : transplant_source : %27%04%F0%2B%96%1B0%A7%DB%81D%26%81%A0u%C9j%3E%A2%B0
This commit is contained in:
parent
a271cbe858
commit
9440229293
@ -133,6 +133,21 @@ PodArrayCopy(T (&dst)[N], const T (&src)[N])
|
|||||||
PodCopy(dst, src, N);
|
PodCopy(dst, src, N);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the memory for |nelem| T elements from |src| to |dst|. If the two
|
||||||
|
* memory ranges overlap, then the effect is as if the |nelem| elements are
|
||||||
|
* first copied from |src| to a temporary array, and then from the temporary
|
||||||
|
* array to |dst|.
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
MOZ_ALWAYS_INLINE static void
|
||||||
|
PodMove(T* dst, const T* src, size_t nelem)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(nelem <= SIZE_MAX / sizeof(T),
|
||||||
|
"trying to move an impossible number of elements");
|
||||||
|
memmove(dst, src, nelem * sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the |len| elements at |one| are memory-identical to the
|
* Determine whether the |len| elements at |one| are memory-identical to the
|
||||||
* |len| elements at |two|.
|
* |len| elements at |two|.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user