<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 03/10/17 19:13, Jason Ekstrand
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOFGe97c8sW-qPf+kS3bisP7L9XtWsJB5WY3C1WjwAMDJWgp0Q@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Tue, Oct 3, 2017 at 9:43 AM, Chad
Versace <span dir="ltr"><<a
href="mailto:chadversary@chromium.org" target="_blank"
moz-do-not-send="true">chadversary@chromium.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><span
class="">On Tue 03 Oct 2017, Lionel Landwerlin wrote:<br>
> v2: Simplify offset enum computation (Jason)<br>
><br>
> Signed-off-by: Lionel Landwerlin <<a
href="mailto:lionel.g.landwerlin@intel.com"
moz-do-not-send="true">lionel.g.landwerlin@intel.com</a><wbr>><br>
> ---<br>
> src/vulkan/util/vk_util.h | 6 ++++++<br>
> 1 file changed, 6 insertions(+)<br>
><br>
> diff --git a/src/vulkan/util/vk_util.h
b/src/vulkan/util/vk_util.h<br>
> index 2ed601f881e..8c8cb64d513 100644<br>
> --- a/src/vulkan/util/vk_util.h<br>
> +++ b/src/vulkan/util/vk_util.h<br>
> @@ -199,4 +199,10 @@ __vk_find_struct(void *start,
VkStructureType sType)<br>
><br>
> uint32_t vk_get_driver_version(void);<br>
><br>
> +#define VK_EXT_OFFSET (1000000000UL)<br>
> +#define vk_enum_extension(__enum) \<br>
> + ((__enum) >= VK_EXT_OFFSET ? ((((__enum) -
VK_EXT_OFFSET) / 1000UL) + 1) : 0)<br>
> +#define vk_enum_offset(__enum) \<br>
> + ((__enum) >= VK_EXT_OFFSET ? ((__enum) %
1000) : (__enum))<br>
<br>
</span>The macro functions, when called, look like regular
functions due to<br>
being lowercase. But they don't behave like functions;
their arguments<br>
suffer from the multiple evaluation disease.<br>
<br>
Please rename the macros to be all uppercase, so callers'
expectations<br>
will be set correctly. Or, even better, define them as
inline<br>
functions.</blockquote>
<div><br>
</div>
<div>+1 to static inline<br>
</div>
</div>
</div>
</div>
</blockquote>
<p>Done locally.<br>
</p>
</body>
</html>