Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: fuzz/fuzz.cpp

Issue 1710183002: Do an in-place replacement of SkRandom with Fuzz for FilterFuzz (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: add comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fuzz/Fuzz.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fuzz/fuzz.cpp
diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp
index 40f48175e274141dd81ccf3bd4d403db388c3ec8..d35e7ae4d1561b5ecfb59a8683bb5fe9bae0c554 100644
--- a/fuzz/fuzz.cpp
+++ b/fuzz/fuzz.cpp
@@ -378,8 +378,8 @@ int fuzz_skp(SkData* bytes) {
Fuzz::Fuzz(SkData* bytes) : fBytes(SkSafeRef(bytes)), fNextByte(0) {}
-void Fuzz::signalBug () { raise(SIGSEGV); }
-void Fuzz::signalBoring() { exit(0); }
+void Fuzz::signalBug () { SkDebugf("Signal bug\n"); raise(SIGSEGV); }
+void Fuzz::signalBoring() { SkDebugf("Signal boring\n"); exit(0); }
template <typename T>
T Fuzz::nextT() {
@@ -398,6 +398,12 @@ bool Fuzz::nextBool() { return nextB()&1; }
uint32_t Fuzz::nextU() { return this->nextT<uint32_t>(); }
float Fuzz::nextF() { return this->nextT<float >(); }
+float Fuzz::nextF1() {
+ // This is the same code as is in SkRandom's nextF()
+ unsigned int floatint = 0x3f800000 | (this->nextU() >> 9);
+ float f = SkBits2Float(floatint) - 1.0f;
+ return f;
+}
uint32_t Fuzz::nextRangeU(uint32_t min, uint32_t max) {
if (min > max) {
« no previous file with comments | « fuzz/Fuzz.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698