]> git.cworth.org Git - apitrace/blobdiff - common/trace_fast_callset.cpp
image: Fix allocation of floating point images.
[apitrace] / common / trace_fast_callset.cpp
index d7c4edc15d5e4e171a44ee6e38e4f2fc6d1f5b56..5aebfd21cba9bf47ec2e4702e7df8d2b8695ffd0 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <limits>
 
+#include "os.hpp"
 #include "trace_fast_callset.hpp"
 
 using namespace trace;
@@ -47,11 +48,17 @@ FastCallRange::FastCallRange(CallNo first, CallNo last, int level)
 }
 
 bool
-FastCallRange::contains(CallNo call_no)
+FastCallRange::contains(CallNo call_no) const
 {
     return (first <= call_no && last >= call_no);
 }
 
+bool
+FastCallSet::empty(void) const
+{
+    return max_level == 0;
+}
+
 FastCallSet::FastCallSet(): head(0, 0, MAX_LEVEL)
 {
     head.first = std::numeric_limits<CallNo>::max();
@@ -73,7 +80,7 @@ static int
 random_level (void)
 {
     /* tricky bit -- each bit is '1' 75% of the time */
-    long int bits = random() | random();
+    long int bits = os::random() | os::random();
     int        level = 1;
 
     while (level < MAX_LEVEL)
@@ -181,9 +188,9 @@ FastCallSet::add(CallNo call_no)
 }
 
 bool
-FastCallSet::contains(CallNo call_no)
+FastCallSet::contains(CallNo call_no) const
 {
-    FastCallRange *node;
+    const FastCallRange *node;
     int i;
 
     node = &head;