Assert that cpuinfo is initialized before use

And fix some incorrect indentation.
This commit is contained in:
Nikita Popov 2020-11-27 11:14:07 +01:00
parent 4a7ebb6d83
commit f35b194029
2 changed files with 4 additions and 3 deletions

View file

@ -99,6 +99,7 @@ void zend_cpu_startup(void)
} }
ZEND_API int zend_cpu_supports(zend_cpu_feature feature) { ZEND_API int zend_cpu_supports(zend_cpu_feature feature) {
ZEND_ASSERT(cpuinfo.initialized);
if (feature & ZEND_CPU_EDX_MASK) { if (feature & ZEND_CPU_EDX_MASK) {
return (cpuinfo.edx & (feature & ~ZEND_CPU_EDX_MASK)); return (cpuinfo.edx & (feature & ~ZEND_CPU_EDX_MASK));
} else if (feature & ZEND_CPU_EBX_MASK) { } else if (feature & ZEND_CPU_EBX_MASK) {