| 240 | } |
| 241 | |
| 242 | static bool |
| 243 | db_shift_expr(db_expr_t *valuep) |
| 244 | { |
| 245 | db_expr_t lhs, rhs; |
| 246 | int t; |
| 247 | |
| 248 | if (!db_add_expr(&lhs)) |
| 249 | return (false); |
| 250 | t = db_read_token(); |
| 251 | while (t == tSHIFT_L || t == tSHIFT_R) { |
| 252 | if (!db_add_expr(&rhs)) { |
| 253 | db_printf("Expression syntax error after '%s'\n", |
| 254 | t == tSHIFT_L ? "<<" : ">>"); |
| 255 | db_error(NULL); |
| 256 | /*NOTREACHED*/ |
| 257 | } |
| 258 | if (rhs < 0) { |
| 259 | db_printf("Negative shift amount %jd\n", (intmax_t)rhs); |
| 260 | db_error(NULL); |
| 261 | /*NOTREACHED*/ |
| 262 | } |
| 263 | if (t == tSHIFT_L) |
| 264 | lhs <<= rhs; |
| 265 | else { |
| 266 | /* Shift right is unsigned */ |
| 267 | lhs = (db_addr_t)lhs >> rhs; |
| 268 | } |
| 269 | t = db_read_token(); |
| 270 | } |
| 271 | db_unread_token(t); |
| 272 | *valuep = lhs; |
| 273 | return (true); |
| 274 | } |
| 275 | |
| 276 | static bool |
| 277 | db_logical_relation_expr( |
no test coverage detected