Path: blob/master/dep/zydis/include/Zydis/ShortString.h
4216 views
/***************************************************************************************************12Zyan Disassembler Library (Zydis)34Original Author : Florian Bernd56* Permission is hereby granted, free of charge, to any person obtaining a copy7* of this software and associated documentation files (the "Software"), to deal8* in the Software without restriction, including without limitation the rights9* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10* copies of the Software, and to permit persons to whom the Software is11* furnished to do so, subject to the following conditions:12*13* The above copyright notice and this permission notice shall be included in all14* copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE19* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE22* SOFTWARE.2324***************************************************************************************************/2526/**27* @file28* Defines the immutable and storage-efficient `ZydisShortString` struct, which29* is used to store strings in the generated tables.30*/3132#ifndef ZYDIS_SHORTSTRING_H33#define ZYDIS_SHORTSTRING_H3435#include <Zycore/Defines.h>36#include <Zycore/Types.h>3738#ifdef __cplusplus39extern "C" {40#endif4142/* ============================================================================================== */43/* Enums and types */44/* ============================================================================================== */4546#if !(defined(ZYAN_APPLE))47# pragma pack(push, 1)48#endif4950/**51* Defines the `ZydisShortString` struct.52*53* This compact struct is mainly used for internal string-tables to save up some bytes.54*55* All fields in this struct should be considered as "private". Any changes may lead to unexpected56* behavior.57*/58typedef struct ZydisShortString_59{60/**61* The buffer that contains the actual (null-terminated) string.62*/63const char* data;64/**65* The length (number of characters) of the string (without 0-termination).66*/67ZyanU8 size;68} ZydisShortString;6970#if !(defined(ZYAN_APPLE))71# pragma pack(pop)72#endif7374/* ============================================================================================== */75/* Macros */76/* ============================================================================================== */7778/**79* Declares a `ZydisShortString` from a static C-style string.80*81* @param string The C-string constant.82*/83#define ZYDIS_MAKE_SHORTSTRING(string) \84{ string, sizeof(string) - 1 }8586/* ============================================================================================== */8788#ifdef __cplusplus89}90#endif9192#endif /* ZYDIS_SHORTSTRING_H */939495