Marked unlikely code paths as [[unlikely]]
This commit is contained in:
@@ -88,20 +88,20 @@ namespace OpenVulkano
|
||||
pnmHeader.ascii = val < 4;
|
||||
pnmHeader.color = static_cast<ColorMode>(val - 3);
|
||||
|
||||
if (!(inStream >> pnmHeader.width >> pnmHeader.height))
|
||||
if (!(inStream >> pnmHeader.width >> pnmHeader.height)) [[unlikely]]
|
||||
{
|
||||
throw std::runtime_error("Malformed PNM header: Unable to read width and height!");
|
||||
}
|
||||
if (pnmHeader.width == 0 || pnmHeader.height == 0)
|
||||
if (pnmHeader.width == 0 || pnmHeader.height == 0) [[unlikely]]
|
||||
{
|
||||
throw std::runtime_error("Malformed PNM header: Width and height must be positive!");
|
||||
}
|
||||
|
||||
if (!(inStream >> pnmHeader.maxValue))
|
||||
if (!(inStream >> pnmHeader.maxValue)) [[unlikely]]
|
||||
{
|
||||
throw std::runtime_error("Malformed PNM header: Unable to read maxValue!");
|
||||
}
|
||||
if (pnmHeader.maxValue == 0 || pnmHeader.maxValue > 65535)
|
||||
if (pnmHeader.maxValue == 0 || pnmHeader.maxValue > 65535) [[unlikely]]
|
||||
{
|
||||
throw std::runtime_error("Malformed PNM header: Invalid maxValue (must be between 1 and 65535)!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user