Opened 10 years ago

Closed 10 years ago

#10422 closed enhancement (invalid)

Optimize haiku\src\kits\network\libnetapi\NetworkAddress.cpp

Reported by: vinion Owned by: axeld
Priority: low Milestone: R1
Component: Kits/Network Kit Version: R1/alpha4.1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

The method

static uint8 from_hex(char hex) {

if (isdigit(hex))

return hex - '0';

return tolower(hex) - 'a' + 10;

}

can be replaced with

static uint8 from_hex(char hex) {

return isdigit(hex) ? hex - '0' : tolower(hex) - 'a' + 10;

}

Change History (1)

comment:1 by anevilyak, 10 years ago

Resolution: invalid
Status: newclosed

As stated in the other example, these aren't optimizations. Please stop.

Note: See TracTickets for help on using tickets.