Jelajahi Sumber

Fix for MSVC warning

MSVC warning C4244: conversion from 'uint32_t' to 'uint16_t', possible
loss of data.
NOTE: this could also be fixed by appending & 0xFFFF after the function
call.
Garett Bass 13 tahun lalu
induk
melakukan
68124f49e5
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      include/bx/uint32_t.h

+ 2 - 2
include/bx/uint32_t.h

@@ -474,9 +474,9 @@ namespace bx
 		const uint32_t f_h_e_biased_flag          = uint32_li(0x0000008f);
 		const uint32_t f_s                        = uint32_and(ftou.ui, f_s_mask);
 		const uint32_t f_e                        = uint32_and(ftou.ui, f_e_mask);
-		const uint16_t h_s                        = uint32_srl(f_s, f_h_s_pos_offset);
+		const uint16_t h_s              = (uint16_t)uint32_srl(f_s, f_h_s_pos_offset);
 		const uint32_t f_m                        = uint32_and(ftou.ui, f_m_mask);
-		const uint16_t f_e_amount                 = uint32_srl(f_e, f_e_pos);
+		const uint16_t f_e_amount       = (uint16_t)uint32_srl(f_e, f_e_pos);
 		const uint32_t f_e_half_bias              = uint32_sub(f_e_amount, f_h_bias_offset);
 		const uint32_t f_snan                     = uint32_and(ftou.ui, f_snan_mask);
 		const uint32_t f_m_round_mask             = uint32_and(f_m, f_m_round_bit);