diff options
| author | Florent Monjalet <florent.monjalet@gmail.com> | 2015-10-15 10:09:36 +0200 |
|---|---|---|
| committer | Florent Monjalet <florent.monjalet@gmail.com> | 2015-10-15 10:12:17 +0200 |
| commit | 24d3e96d8805fc2b8fa19788c018bbe2c71529c1 (patch) | |
| tree | 42b41489e57a9973a9801502f1d1a269126fca7f | |
| parent | cb5b9fc9d55b396ddfd6b4930197cb6d9398117c (diff) | |
| download | miasm-24d3e96d8805fc2b8fa19788c018bbe2c71529c1.tar.gz miasm-24d3e96d8805fc2b8fa19788c018bbe2c71529c1.zip | |
Jitload: more concise syntax in has_callback
| -rw-r--r-- | miasm2/jitter/jitload.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py index c5ea83f7..112920a1 100644 --- a/miasm2/jitter/jitload.py +++ b/miasm2/jitter/jitload.py @@ -139,9 +139,7 @@ class CallbackHandlerBitflag(CallbackHandler): # Overrides CallbackHandler's implem, but do not serve for optimization def has_callbacks(self, bitflag): - for b in self.callbacks.iterkeys(): - if b & bitflag != 0: - return True + return any(cb_mask & bitflag != 0 for cb_mask in self.callbacks) def __call__(self, bitflag, *args): """Call each callbacks associated with bit set in bitflag. While @@ -149,7 +147,7 @@ class CallbackHandlerBitflag(CallbackHandler): Iterator on other results""" res = True - for b in self.callbacks.iterkeys(): + for b in self.callbacks: if b & bitflag != 0: # If the flag matched |