CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/Common.h
Views: 1401
// Copyright (C) 2003 Dolphin Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official SVN repository and contact information can be found at15// http://code.google.com/p/dolphin-emu/1617#pragma once1819// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file20// since it slows down the build a lot.2122#include <stdarg.h>2324#ifdef _MSC_VER25#pragma warning(disable:4100)26#pragma warning(disable:4244)27#endif2829#include "CommonTypes.h"30#include "CommonFuncs.h"3132#ifndef DISALLOW_COPY_AND_ASSIGN33#define DISALLOW_COPY_AND_ASSIGN(t) \34t(const t &other) = delete; \35void operator =(const t &other) = delete;36#endif3738#ifndef ENUM_CLASS_BITOPS39#define ENUM_CLASS_BITOPS(T) \40static inline T operator |(const T &lhs, const T &rhs) { \41return T((int)lhs | (int)rhs); \42} \43static inline T &operator |= (T &lhs, const T &rhs) { \44lhs = lhs | rhs; \45return lhs; \46} \47static inline bool operator &(const T &lhs, const T &rhs) { \48return ((int)lhs & (int)rhs) != 0; \49} \50static inline T &operator &= (T &lhs, const T &rhs) { \51lhs = (T)((int)lhs & (int)rhs); \52return lhs; \53} \54static inline T operator ~(const T &rhs) { \55return (T)(~((int)rhs)); \56}57#endif5859#ifndef ARRAY_SIZE60#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))61#endif6263#if defined(_WIN32)6465// Memory leak checks66#define CHECK_HEAP_INTEGRITY()6768// Debug definitions69#if defined(_DEBUG)70#include <crtdbg.h>71#undef CHECK_HEAP_INTEGRITY72#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) _assert_msg_(false, "Memory corruption detected. See log.");}73#endif74#else7576#define CHECK_HEAP_INTEGRITY()7778#endif7980// Windows compatibility81#ifndef _WIN3282#include <limits.h>83#ifndef MAX_PATH84#define MAX_PATH PATH_MAX85#endif8687#define __forceinline inline __attribute__((always_inline))88#endif8990#if defined __SSE4_2__91# define _M_SSE 0x40292#elif defined __SSE4_1__93# define _M_SSE 0x40194#elif defined __SSSE3__95# define _M_SSE 0x30196#elif defined __SSE3__97# define _M_SSE 0x30098#elif defined __SSE2__99# define _M_SSE 0x200100#elif !defined(__GNUC__) && (defined(_M_X64) || defined(_M_IX86))101# define _M_SSE 0x402102#endif103104105