| 195 | } |
| 196 | |
| 197 | struct feature_set *feature_set_for_feature(const tal_t *ctx, int feature) |
| 198 | { |
| 199 | struct feature_set *fs = tal(ctx, struct feature_set); |
| 200 | |
| 201 | for (size_t i = 0; i < ARRAY_SIZE(fs->bits); i++) { |
| 202 | fs->bits[i] = tal_arr(fs, u8, 0); |
| 203 | switch (feature_copy_style(feature, i)) { |
| 204 | case FEATURE_DONT_REPRESENT: |
| 205 | continue; |
| 206 | case FEATURE_REPRESENT: |
| 207 | set_feature_bit(&fs->bits[i], feature); |
| 208 | continue; |
| 209 | case FEATURE_REPRESENT_AS_OPTIONAL: |
| 210 | set_feature_bit(&fs->bits[i], OPTIONAL_FEATURE(feature)); |
| 211 | continue; |
| 212 | } |
| 213 | abort(); |
| 214 | } |
| 215 | return fs; |
| 216 | } |
| 217 | |
| 218 | bool feature_set_or(struct feature_set *a, |
| 219 | const struct feature_set *b TAKES) |