Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for answer to Optimization and Methods for Reversing Nibbles of a Byte by Eric Postpischil

Current License: CC BY-SA 4.0

Post Revisions

7 events
when toggle format what by license comment
Feb 12, 2025 at 11:47 comment added Eric Postpischil @Lundin: Yes, indeed it does, and the explicitly specified conversion will produce an unsigned char value.
Feb 12, 2025 at 11:44 comment added Lundin But neglecting the cast means that negative values will get sign extended upon default argument promotion.
Feb 12, 2025 at 11:12 comment added Eric Postpischil @Lundin: This is not necessary. The C standard observes the argument will be promoted to int and explicitly specifies that its value "shall be converted to signed char or unsigned char before printing." Thus the conversion is already in printf and need not be performed by the caller.
Feb 12, 2025 at 9:32 comment added Lundin Pedantically, it should be printf("0x%hhX\n", (unsigned char)byte);
Feb 11, 2025 at 21:53 vote accept Legended
Feb 11, 2025 at 20:05 history edited Eric Postpischil CC BY-SA 4.0
added 213 characters in body
Feb 11, 2025 at 20:00 history answered Eric Postpischil CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /