diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2016-10-21 11:54:18 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2016-10-21 11:54:18 +0200 |
commit | a291e77b2cfc4ce1b780db0d8fa664fb8094d365 (patch) | |
tree | 88f0085d143b3e93862482de364559aa9946b1e6 /src/emu | |
parent | 5bdb4f7a8974c550608c83b8872e89259211496e (diff) |
some bool <-> int not needed conversions, also cleaned drivenum.* was using memset for clearing vector (nw)
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/debug/debugcpu.h | 4 | ||||
-rw-r--r-- | src/emu/diserial.cpp | 4 | ||||
-rw-r--r-- | src/emu/diserial.h | 2 | ||||
-rw-r--r-- | src/emu/distate.h | 2 | ||||
-rw-r--r-- | src/emu/drivenum.cpp | 8 | ||||
-rw-r--r-- | src/emu/drivenum.h | 4 | ||||
-rw-r--r-- | src/emu/ioport.cpp | 2 | ||||
-rw-r--r-- | src/emu/render.cpp | 16 | ||||
-rw-r--r-- | src/emu/rendutil.cpp | 22 | ||||
-rw-r--r-- | src/emu/rendutil.h | 4 | ||||
-rw-r--r-- | src/emu/screen.cpp | 2 | ||||
-rw-r--r-- | src/emu/sound.cpp | 2 | ||||
-rw-r--r-- | src/emu/uiinput.cpp | 2 | ||||
-rw-r--r-- | src/emu/video.cpp | 26 | ||||
-rw-r--r-- | src/emu/video.h | 2 |
15 files changed, 48 insertions, 54 deletions
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 66bbe48e1f2..7ec39ba4863 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -80,7 +80,7 @@ public: const device_debug * m_debugInterface; // the interface we were created from breakpoint * m_next; // next in the list int m_index; // user reported index - UINT8 m_enabled; // enabled? + bool m_enabled; // enabled? offs_t m_address; // execution address parsed_expression m_condition; // condition std::string m_action; // action @@ -156,7 +156,7 @@ public: registerpoint * m_next; // next in the list int m_index; // user reported index - UINT8 m_enabled; // enabled? + bool m_enabled; // enabled? parsed_expression m_condition; // condition std::string m_action; // action }; diff --git a/src/emu/diserial.cpp b/src/emu/diserial.cpp index 4613da0d4ad..182360fab3a 100644 --- a/src/emu/diserial.cpp +++ b/src/emu/diserial.cpp @@ -454,12 +454,12 @@ UINT8 device_serial_interface::transmit_register_get_data_bit() bool device_serial_interface::is_receive_register_full() { - return m_rcv_flags & RECEIVE_REGISTER_FULL; + return (m_rcv_flags & RECEIVE_REGISTER_FULL)!=0; } bool device_serial_interface::is_transmit_register_empty() { - return m_tra_flags & TRANSMIT_REGISTER_EMPTY; + return (m_tra_flags & TRANSMIT_REGISTER_EMPTY)!=0; } const char *device_serial_interface::parity_tostring(parity_t parity) diff --git a/src/emu/diserial.h b/src/emu/diserial.h index 12c2479234b..1d4d957a041 100644 --- a/src/emu/diserial.h +++ b/src/emu/diserial.h @@ -109,7 +109,7 @@ protected: bool is_receive_register_full(); bool is_transmit_register_empty(); - bool is_receive_register_synchronized() const { return m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED; } + bool is_receive_register_synchronized() const { return (m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED)!=0; } bool is_receive_register_shifting() const { return m_rcv_bit_count_received > 0; } bool is_receive_framing_error() const { return m_rcv_framing_error; } bool is_receive_parity_error() const { return m_rcv_parity_error; } diff --git a/src/emu/distate.h b/src/emu/distate.h index f4558129bbd..c608e832775 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -63,7 +63,7 @@ public: void *dataptr() const { return m_dataptr.v; } const char *symbol() const { return m_symbol.c_str(); } bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); } - bool divider() const { return m_flags & DSF_DIVIDER; } + bool divider() const { return ((m_flags & DSF_DIVIDER) != 0); } device_state_interface *parent_state() const {return m_device_state;} protected: diff --git a/src/emu/drivenum.cpp b/src/emu/drivenum.cpp index 450790eb55a..5f67013c603 100644 --- a/src/emu/drivenum.cpp +++ b/src/emu/drivenum.cpp @@ -135,8 +135,6 @@ driver_enumerator::driver_enumerator(emu_options &options) m_included(s_driver_count), m_config(s_driver_count) { - memset(&m_included[0], 0, s_driver_count); - memset(&m_config[0], 0, s_driver_count*sizeof(m_config[0])); include_all(); } @@ -148,8 +146,6 @@ driver_enumerator::driver_enumerator(emu_options &options, const char *string) m_included(s_driver_count), m_config(s_driver_count) { - memset(&m_included[0], 0, s_driver_count); - memset(&m_config[0], 0, s_driver_count*sizeof(m_config[0])); filter(string); } @@ -161,8 +157,6 @@ driver_enumerator::driver_enumerator(emu_options &options, const game_driver &dr m_included(s_driver_count), m_config(s_driver_count) { - memset(&m_included[0], 0, s_driver_count); - memset(&m_config[0], 0, s_driver_count*sizeof(m_config[0])); filter(driver); } @@ -247,7 +241,7 @@ int driver_enumerator::filter(const game_driver &driver) void driver_enumerator::include_all() { - memset(&m_included[0], 1, sizeof(m_included[0]) * s_driver_count); + std::fill(m_included.begin(), m_included.end(), true); m_filtered_count = s_driver_count; // always exclude the empty driver diff --git a/src/emu/drivenum.h b/src/emu/drivenum.h index cc3bad554bf..3732915b46a 100644 --- a/src/emu/drivenum.h +++ b/src/emu/drivenum.h @@ -113,7 +113,7 @@ public: int filter(const char *string = nullptr); int filter(const game_driver &driver); void include_all(); - void exclude_all() { memset(&m_included[0], 0, sizeof(m_included[0]) * s_driver_count); m_filtered_count = 0; } + void exclude_all() { std::fill(m_included.begin(), m_included.end(), false); m_filtered_count = 0; } void reset() { m_current = -1; } bool next(); bool next_excluded(); @@ -132,7 +132,7 @@ private: int m_current; int m_filtered_count; emu_options & m_options; - std::vector<UINT8> m_included; + std::vector<bool> m_included; mutable std::vector<std::unique_ptr<machine_config>> m_config; mutable std::vector<int> m_config_cache; }; diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 7ecf6fe5c1e..c110bc9719f 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -2516,7 +2516,7 @@ bool ioport_manager::playback_read<bool>(bool &result) { UINT8 temp; playback_read(temp); - return result = bool(temp); + return result = temp!=0; } diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 0e28f3c0494..891ed88470e 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -967,7 +967,7 @@ render_target::render_target(render_manager &manager, const internal_layout *lay m_layerconfig = m_base_layerconfig; // load the layout files - load_layout_files(layoutfile, flags & RENDER_CREATE_SINGLE_FILE); + load_layout_files(layoutfile, (flags & RENDER_CREATE_SINGLE_FILE)!=0); // set the current view to the first one set_view(0); @@ -1219,7 +1219,7 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height int scale_mode = m_scale_mode; if (m_scale_mode == SCALE_FRACTIONAL_AUTO) { - bool is_rotated = (m_manager.machine().system().flags & ORIENTATION_SWAP_XY) ^ (target_orientation & ORIENTATION_SWAP_XY); + bool is_rotated = ((m_manager.machine().system().flags & ORIENTATION_SWAP_XY) ^ (target_orientation & ORIENTATION_SWAP_XY))!=0; scale_mode = is_rotated ^ target_is_portrait ? SCALE_FRACTIONAL_Y : SCALE_FRACTIONAL_X; } @@ -2235,27 +2235,27 @@ void render_target::config_load(xml_data_node &targetnode) // modify the artwork config int tmpint = xml_get_attribute_int(&targetnode, "backdrops", -1); if (tmpint == 0 || tmpint == 1) - set_backdrops_enabled(tmpint); + set_backdrops_enabled(tmpint != 0); tmpint = xml_get_attribute_int(&targetnode, "overlays", -1); if (tmpint == 0 || tmpint == 1) - set_overlays_enabled(tmpint); + set_overlays_enabled(tmpint != 0); tmpint = xml_get_attribute_int(&targetnode, "bezels", -1); if (tmpint == 0 || tmpint == 1) - set_bezels_enabled(tmpint); + set_bezels_enabled(tmpint != 0); tmpint = xml_get_attribute_int(&targetnode, "cpanels", -1); if (tmpint == 0 || tmpint == 1) - set_cpanels_enabled(tmpint); + set_cpanels_enabled(tmpint != 0); tmpint = xml_get_attribute_int(&targetnode, "marquees", -1); if (tmpint == 0 || tmpint == 1) - set_marquees_enabled(tmpint); + set_marquees_enabled(tmpint != 0); tmpint = xml_get_attribute_int(&targetnode, "zoom", -1); if (tmpint == 0 || tmpint == 1) - set_zoom_to_screen(tmpint); + set_zoom_to_screen(tmpint != 0); // apply orientation tmpint = xml_get_attribute_int(&targetnode, "rotate", -1); diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index c356a1d0abd..1d59c92db0b 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -262,7 +262,7 @@ static void resample_argb_bitmap_bilinear(UINT32 *dest, UINT32 drowpixels, UINT3 render_clip_line - clip a line to a rectangle -------------------------------------------------*/ -int render_clip_line(render_bounds *bounds, const render_bounds *clip) +bool render_clip_line(render_bounds *bounds, const render_bounds *clip) { /* loop until we get a final result */ while (1) @@ -291,13 +291,13 @@ int render_clip_line(render_bounds *bounds, const render_bounds *clip) if (bounds->x1 < clip->x0) code1 |= 8; - /* trivial accept: just return FALSE */ + /* trivial accept: just return false */ if ((code0 | code1) == 0) - return FALSE; + return false; - /* trivial reject: just return TRUE */ + /* trivial reject: just return true */ if ((code0 & code1) != 0) - return TRUE; + return true; /* fix one of the OOB cases */ thiscode = code0 ? code0 : code1; @@ -349,7 +349,7 @@ int render_clip_line(render_bounds *bounds, const render_bounds *clip) render_clip_quad - clip a quad to a rectangle -------------------------------------------------*/ -int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords) +bool render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords) { /* ensure our assumptions about the bounds are correct */ assert(bounds->x0 <= bounds->x1); @@ -357,13 +357,13 @@ int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_qu /* trivial reject */ if (bounds->y1 < clip->y0) - return TRUE; + return true; if (bounds->y0 > clip->y1) - return TRUE; + return true; if (bounds->x1 < clip->x0) - return TRUE; + return true; if (bounds->x0 > clip->x1) - return TRUE; + return true; /* clip top (x0,y0)-(x1,y1) */ if (bounds->y0 < clip->y0) @@ -420,7 +420,7 @@ int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_qu texcoords->br.v -= (texcoords->br.v - texcoords->bl.v) * frac; } } - return FALSE; + return false; } diff --git a/src/emu/rendutil.h b/src/emu/rendutil.h index 2aa898ac470..9d3bb526c6d 100644 --- a/src/emu/rendutil.h +++ b/src/emu/rendutil.h @@ -22,8 +22,8 @@ /* ----- render utilities ----- */ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, const render_color &color, bool force = false); -int render_clip_line(render_bounds *bounds, const render_bounds *clip); -int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords); +bool render_clip_line(render_bounds *bounds, const render_bounds *clip); +bool render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords); void render_line_to_quad(const render_bounds *bounds, float width, float length_extension, render_bounds *bounds0, render_bounds *bounds1); void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename); bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename, bool load_as_alpha_to_existing = false); diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 1d10b515f43..21616086280 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -248,7 +248,7 @@ void screen_device_svg_renderer::output_change(const char *outname, INT32 value) auto l = m_key_ids.find(outname); if (l == m_key_ids.end()) return; - m_key_state[l->second] = value; + m_key_state[l->second] = value!=0; } void screen_device_svg_renderer::compute_initial_bboxes(std::vector<bbox> &bboxes) diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index cafd6fbfde9..70415f7532f 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -1060,7 +1060,7 @@ void sound_manager::update(void *ptr, int param) // force all the speaker streams to generate the proper number of samples int samples_this_update = 0; for (speaker_device &speaker : speaker_device_iterator(machine().root_device())) - speaker.mix(&m_leftmix[0], &m_rightmix[0], samples_this_update, (m_muted & MUTE_REASON_SYSTEM)); + speaker.mix(&m_leftmix[0], &m_rightmix[0], samples_this_update, (m_muted & MUTE_REASON_SYSTEM)!=0); // now downmix the final result UINT32 finalmix_step = machine().video().speed_factor(); diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index 9707793b2a3..0523decc27d 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -244,7 +244,7 @@ bool ui_input_manager::pressed(int code) bool ui_input_manager::pressed_repeat(int code, int speed) { - int pressed; + bool pressed; g_profiler.start(PROFILER_INPUT); diff --git a/src/emu/video.cpp b/src/emu/video.cpp index abd1bd24066..627b2f1f6da 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -35,20 +35,20 @@ //************************************************************************** // frameskipping tables -const UINT8 video_manager::s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS] = +const bool video_manager::s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS] = { - { 0,0,0,0,0,0,0,0,0,0,0,0 }, - { 0,0,0,0,0,0,0,0,0,0,0,1 }, - { 0,0,0,0,0,1,0,0,0,0,0,1 }, - { 0,0,0,1,0,0,0,1,0,0,0,1 }, - { 0,0,1,0,0,1,0,0,1,0,0,1 }, - { 0,1,0,0,1,0,1,0,0,1,0,1 }, - { 0,1,0,1,0,1,0,1,0,1,0,1 }, - { 0,1,0,1,1,0,1,0,1,1,0,1 }, - { 0,1,1,0,1,1,0,1,1,0,1,1 }, - { 0,1,1,1,0,1,1,1,0,1,1,1 }, - { 0,1,1,1,1,1,0,1,1,1,1,1 }, - { 0,1,1,1,1,1,1,1,1,1,1,1 } + { false,false,false,false,false,false,false,false,false,false,false,false }, + { false,false,false,false,false,false,false,false,false,false,false,true }, + { false,false,false,false,false,true ,false,false,false,false,false,true }, + { false,false,false,true ,false,false,false,true ,false,false,false,true }, + { false,false,true ,false,false,true ,false,false,true ,false,false,true }, + { false,true ,false,false,true ,false,true ,false,false,true ,false,true }, + { false,true ,false,true ,false,true ,false,true ,false,true ,false,true }, + { false,true ,false,true ,true ,false,true ,false,true ,true ,false,true }, + { false,true ,true ,false,true ,true ,false,true ,true ,false,true ,true }, + { false,true ,true ,true ,false,true ,true ,true ,false,true ,true ,true }, + { false,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true }, + { false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true } }; diff --git a/src/emu/video.h b/src/emu/video.h index cf6a1a05017..64536083764 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -194,7 +194,7 @@ private: // movie recording - dummy bool m_dummy_recording; // indicates if snapshot should be created of every frame - static const UINT8 s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS]; + static const bool s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS]; static const attoseconds_t ATTOSECONDS_PER_SPEED_UPDATE = ATTOSECONDS_PER_SECOND / 4; static const int PAUSED_REFRESH_RATE = 30; |