| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | 5 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return false; | 213 return false; |
| 214 } | 214 } |
| 215 | 215 |
| 216 uint64_t DefaultMask(size_t size) { | 216 uint64_t DefaultMask(size_t size) { |
| 217 switch (size) { | 217 switch (size) { |
| 218 case 4: | 218 case 4: |
| 219 return std::numeric_limits<uint32_t>::max(); | 219 return std::numeric_limits<uint32_t>::max(); |
| 220 case 8: | 220 case 8: |
| 221 return std::numeric_limits<uint64_t>::max(); | 221 return std::numeric_limits<uint64_t>::max(); |
| 222 default: | 222 default: |
| 223 CHECK(false) << "Unimplemented DefaultMask case"; | 223 // Unimplemented DefaultMask case |
| 224 CHECK(false); |
| 224 return 0; | 225 return 0; |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 | 228 |
| 228 BoolExpr ArgEq(int num, size_t size, uint64_t mask, uint64_t val) { | 229 BoolExpr ArgEq(int num, size_t size, uint64_t mask, uint64_t val) { |
| 229 // If this is changed, update Arg<T>::EqualTo's static_cast rules | 230 // If this is changed, update Arg<T>::EqualTo's static_cast rules |
| 230 // accordingly. | 231 // accordingly. |
| 231 CHECK(size == 4 || size == 8); | 232 CHECK(size == 4 || size == 8); |
| 232 | 233 |
| 233 return std::make_shared<MaskedEqualBoolExprImpl>(num, size, mask, val); | 234 return std::make_shared<MaskedEqualBoolExprImpl>(num, size, mask, val); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 return expr; | 335 return expr; |
| 335 } | 336 } |
| 336 | 337 |
| 337 } // namespace bpf_dsl | 338 } // namespace bpf_dsl |
| 338 } // namespace sandbox | 339 } // namespace sandbox |
| 339 | 340 |
| 340 namespace std { | 341 namespace std { |
| 341 template class shared_ptr<const sandbox::bpf_dsl::internal::BoolExprImpl>; | 342 template class shared_ptr<const sandbox::bpf_dsl::internal::BoolExprImpl>; |
| 342 template class shared_ptr<const sandbox::bpf_dsl::internal::ResultExprImpl>; | 343 template class shared_ptr<const sandbox::bpf_dsl::internal::ResultExprImpl>; |
| 343 } // namespace std | 344 } // namespace std |
| OLD | NEW |