MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_shift_expr

Function db_shift_expr

freebsd/ddb/db_expr.c:242–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242static bool
243db_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
276static bool
277db_logical_relation_expr(

Callers 1

db_logical_relation_exprFunction · 0.85

Calls 5

db_add_exprFunction · 0.85
db_read_tokenFunction · 0.85
db_printfFunction · 0.85
db_errorFunction · 0.85
db_unread_tokenFunction · 0.85

Tested by

no test coverage detected