Open
Description
opened on Oct 8, 2024
This would be very similar to "Invert if," but it would be available for code like the following:
#if !NET3_0_OR_GREATER
// Distribution is expected to be heavily weighted towards large palettes
if (paletteLength > 128) return 8;
if (paletteLength > 64) return 7;
if (paletteLength > 32) return 6;
if (paletteLength > 16) return 5;
if (paletteLength > 8) return 4;
if (paletteLength > 4) return 3;
if (paletteLength > 2) return 2;
return 1;
#else
return paletteLength <= 2 ? (byte)1 :
(byte)((sizeof(uint) * 8) - System.Numerics.BitOperations.LeadingZeroCount(paletteLength - 1));
#endif
Expected result:
#if NET3_0_OR_GREATER
return paletteLength <= 2 ? (byte)1 :
(byte)((sizeof(uint) * 8) - System.Numerics.BitOperations.LeadingZeroCount(paletteLength - 1));
#else
// Distribution is expected to be heavily weighted towards large palettes
if (paletteLength > 128) return 8;
if (paletteLength > 64) return 7;
if (paletteLength > 32) return 6;
if (paletteLength > 16) return 5;
if (paletteLength > 8) return 4;
if (paletteLength > 4) return 3;
if (paletteLength > 2) return 2;
return 1;
#endif
Activity