d3dcompiler: Move read_u32() to a new utils.h private header.

To be able to use it from d3d10 via PARENTSRC.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2022-02-09 16:30:08 +01:00 committed by Alexandre Julliard
parent b5d610ca37
commit 8c29458630
2 changed files with 34 additions and 9 deletions

View File

@ -33,6 +33,7 @@
#include "objbase.h"
#include "d3dcompiler.h"
#include "utils.h"
#include <assert.h>
#include <stdint.h>
@ -568,15 +569,6 @@ HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc) DECLSP
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, size_t data_size) DECLSPEC_HIDDEN;
HRESULT dxbc_init(struct dxbc *dxbc, unsigned int size) DECLSPEC_HIDDEN;
static inline uint32_t read_u32(const char **ptr)
{
uint32_t r;
memcpy(&r, *ptr, sizeof(r));
*ptr += sizeof(r);
return r;
}
static inline void write_u32(char **ptr, uint32_t u32)
{
memcpy(*ptr, &u32, sizeof(u32));

View File

@ -0,0 +1,33 @@
/*
* Copyright 2022 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_UTILS_H
#define __WINE_UTILS_H
#include <stdint.h>
static inline uint32_t read_u32(const char **ptr)
{
uint32_t r;
memcpy(&r, *ptr, sizeof(r));
*ptr += sizeof(r);
return r;
}
#endif /* __WINE_UTILS_H */