[Webkit-unassigned] [Bug 36849] Add zero() method to Vector class
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Mar 31 14:47:15 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=36849
Sam Weinig <sam at webkit.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sam at webkit.org
--- Comment #10 from Sam Weinig <sam at webkit.org> 2010-03-31 14:47:15 PST ---
What about something like either of these.
namespace WTF {
template <bool canZero, typename T>
struct ZeroFiller;
template<typename T>
struct ZeroFiller<true, T> {
static void zero(T* begin, T* end)
{
memset(begin, 0, reinterpret_cast<char*>(end) -
reinterpret_cast<char*>(begin));
}
};
template<typename T>
void zeroFill(T* begin, T* end)
{
ZeroFiller::zero<IsPod<T>::value, T>(first, last)
}
} // namespace WTF
or
namespace WTF {
template<typename T>
void zeroFill(T* begin, T* end)
{
COMPILE_ASSERT(IsPod<T>);
memset(begin, 0, reinterpret_cast<char*>(end) -
reinterpret_cast<char*>(begin));
}
} // namespace WTF
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list