mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-06 10:44:06 +00:00
More minor stylization changes (remove unneeded parentheses)
This commit is contained in:
@@ -441,7 +441,7 @@ load_from_stream :: proc(stream: io.Stream, options := Options{}, allocator := c
|
||||
}
|
||||
// name := chunk_type_to_name(&ch.type); // Only used for debug prints during development.
|
||||
|
||||
#partial switch(ch.type) {
|
||||
#partial switch ch.type {
|
||||
case .IHDR:
|
||||
if seen_ihdr || !first {
|
||||
return {}, E_PNG.IHDR_Not_First_Chunk;
|
||||
@@ -575,7 +575,7 @@ load_from_stream :: proc(stream: io.Stream, options := Options{}, allocator := c
|
||||
}
|
||||
|
||||
ct := transmute(u8)info.header.color_type;
|
||||
switch(ct) {
|
||||
switch ct {
|
||||
case 3: // Indexed color
|
||||
if c.header.length != 1 {
|
||||
return {}, E_PNG.BKGD_Invalid_Length;
|
||||
|
||||
@@ -337,7 +337,7 @@ write :: proc(fd: Handle, data: []u8) -> (int, Errno) {
|
||||
return 0, 0;
|
||||
}
|
||||
bytes_written := _unix_write(fd, raw_data(data), len(data));
|
||||
if(bytes_written == -1) {
|
||||
if bytes_written == -1 {
|
||||
return 0, 1;
|
||||
}
|
||||
return bytes_written, 0;
|
||||
|
||||
@@ -362,7 +362,7 @@ __dynamic_map_erase :: proc(using h: Map_Header, fr: Map_Find_Result) #no_bounds
|
||||
curr := __dynamic_map_get_entry(h, fr.entry_index);
|
||||
prev.next = curr.next;
|
||||
}
|
||||
if (fr.entry_index == m.entries.len-1) {
|
||||
if fr.entry_index == m.entries.len-1 {
|
||||
// NOTE(bill): No need to do anything else, just pop
|
||||
} else {
|
||||
old := __dynamic_map_get_entry(h, fr.entry_index);
|
||||
|
||||
@@ -600,19 +600,19 @@ truncsfhf2 :: proc "c" (value: f32) -> u16 {
|
||||
m = i & 0x007fffff;
|
||||
|
||||
|
||||
if (e <= 0) {
|
||||
if (e < -10) {
|
||||
if e <= 0 {
|
||||
if e < -10 {
|
||||
return u16(s);
|
||||
}
|
||||
m = (m | 0x00800000) >> u32(1 - e);
|
||||
|
||||
if (m & 0x00001000) != 0 {
|
||||
if m & 0x00001000 != 0 {
|
||||
m += 0x00002000;
|
||||
}
|
||||
|
||||
return u16(s | (m >> 13));
|
||||
} else if (e == 0xff - (127 - 15)) {
|
||||
if (m == 0) {
|
||||
} else if e == 0xff - (127 - 15) {
|
||||
if m == 0 {
|
||||
return u16(s | 0x7c00); /* NOTE(bill): infinity */
|
||||
} else {
|
||||
/* NOTE(bill): NAN */
|
||||
@@ -620,7 +620,7 @@ truncsfhf2 :: proc "c" (value: f32) -> u16 {
|
||||
return u16(s | 0x7c00 | m | i32(m == 0));
|
||||
}
|
||||
} else {
|
||||
if (m & 0x00001000) != 0 {
|
||||
if m & 0x00001000 != 0 {
|
||||
m += 0x00002000;
|
||||
if (m & 0x00800000) != 0 {
|
||||
m = 0;
|
||||
@@ -628,7 +628,7 @@ truncsfhf2 :: proc "c" (value: f32) -> u16 {
|
||||
}
|
||||
}
|
||||
|
||||
if (e > 30) {
|
||||
if e > 30 {
|
||||
f := i64(1e12);
|
||||
for j := 0; j < 10; j += 1 {
|
||||
/* NOTE(bill): Cause overflow */
|
||||
|
||||
@@ -526,7 +526,7 @@ scan :: proc(s: ^Scanner) -> (tok: rune) {
|
||||
s.pos.line = 0;
|
||||
|
||||
redo: for {
|
||||
for (ch < utf8.RUNE_SELF && ch in s.whitespace) {
|
||||
for ch < utf8.RUNE_SELF && (ch in s.whitespace) {
|
||||
ch = advance(s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user