[NSWI004] Note on is_power_of_two

Miroslav Hrabal MHN at email.cz
Tue Jan 5 01:07:30 CET 2021


Greetings,




I don't think your counterexample here is valid as 3 = 0b11 and not 0b101 (=
5).




Sincerely,




Miroslav Hrabal







---------- Původní e-mail ----------
Od: Thomas Mol <thomasfolkertmol at gmail.com>
Komu: Operating Systems Course <nswi004 at d3s.mff.cuni.cz>
Datum: 5. 1. 2021 0:43:29
Předmět: [NSWI004] Note on is_power_of_two 
"Good night,

The trick used in the is_power_of_two inline looks nice, but it's not
actually valid. For example, 3 has no common bits with 3 - 1 (0b101
and 0b010).
Is there a particular reason our frame allocator should only allocate
powers of two anyway?

Best regards,
Thomas Folkert Mol
_______________________________________________
NSWI004 mailing list
NSWI004 at d3s.mff.cuni.cz
https://d3s.mff.cuni.cz/mailman/listinfo/nswi004
"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://d3s.mff.cuni.cz/pipermail/nswi004/attachments/20210105/bcd04887/attachment.htm>


More information about the NSWI004 mailing list