-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
The fact those constants are declared as enum makes defining your own flags undefined behavior for the helper functions set_flag() and get_flag(). The flags member of halide_buffer_t is already uint64_t.
Halide/src/runtime/HalideRuntime.h
Lines 1544 to 1545 in 990eb5f
| typedef enum { halide_buffer_flag_host_dirty = 1, | |
| halide_buffer_flag_device_dirty = 2 } halide_buffer_flags; |
Halide/src/runtime/HalideRuntime.h
Lines 1583 to 1593 in 990eb5f
| HALIDE_ALWAYS_INLINE bool get_flag(halide_buffer_flags flag) const { | |
| return (flags & flag) != 0; | |
| } | |
| HALIDE_ALWAYS_INLINE void set_flag(halide_buffer_flags flag, bool value) { | |
| if (value) { | |
| flags |= flag; | |
| } else { | |
| flags &= ~uint64_t(flag); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels