mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	 ceb327789b
			
		
	
	
		ceb327789b
		
	
	
	
	
		
			
			As per the const correctness rules, top-level const-ness of data in automatic scopes does not propagate outside of these scopes (unlike const-ness at lower levels, such as pointers to const data). Previously, const was used liberally, but inconsistently across the libpng codebase. Using const wherever applicable is not incorrect. However, _consistent_ use of const is difficult to maintain in such conditions. In conclusion, we shall continue to use const only where doing so is strictly necessary: 1. If a function guarantees that it will not modify an argument passed by pointer, the corresponding function parameter should be a pointer-to-const (const T *). 2. Static data should not be modified, therefore it should be const. Reference: Google C++ Style Guide https://google.github.io/styleguide/cppguide.html#Use_of_const
		
			
				
	
	
		
			35 lines
		
	
	
		
			880 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			880 B
		
	
	
	
		
			C
		
	
	
	
	
	
| /* contrib/powerpc-vsx/linux_aux.c
 | |
|  *
 | |
|  * Copyright (c) 2017 Glenn Randers-Pehrson
 | |
|  * Written by Vadim Barkov, 2017.
 | |
|  * Last changed in libpng 1.6.29 [March 16, 2017]
 | |
|  *
 | |
|  * This code is released under the libpng license.
 | |
|  * For conditions of distribution and use, see the disclaimer
 | |
|  * and license in png.h
 | |
|  *
 | |
|  * STATUS: TESTED
 | |
|  * BUG REPORTS: png-mng-implement@sourceforge.net
 | |
|  *
 | |
|  * png_have_vsx implemented for Linux by using the auxiliary vector mechanism.
 | |
|  *
 | |
|  * This code is strict ANSI-C and is probably moderately portable; it does
 | |
|  * however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
 | |
|  */
 | |
| 
 | |
| #include "sys/auxv.h"
 | |
| #include "png.h"
 | |
| 
 | |
| static int
 | |
| png_have_vsx(png_structp png_ptr)
 | |
| {
 | |
|    unsigned long auxv = getauxval(AT_HWCAP);
 | |
| 
 | |
|    PNG_UNUSED(png_ptr)
 | |
| 
 | |
|    if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX))
 | |
|       return 1;
 | |
|    else
 | |
|       return 0;
 | |
| }
 |