mirror of
				https://github.com/yuzu-emu/FasTC.git
				synced 2025-11-04 15:25:06 +00:00 
			
		
		
		
	Refactor to FasTC::Replicate where appropriate
This commit is contained in:
		
							parent
							
								
									ed61bcfee4
								
							
						
					
					
						commit
						4e45988caa
					
				| 
						 | 
				
			
			@ -62,6 +62,7 @@
 | 
			
		|||
 | 
			
		||||
#include "TexCompTypes.h"
 | 
			
		||||
 | 
			
		||||
#include "Bits.h"
 | 
			
		||||
#include "BitStream.h"
 | 
			
		||||
using FasTC::BitStreamReadOnly;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -334,24 +335,13 @@ namespace ASTCC {
 | 
			
		|||
      assert(bitlen >= 1);
 | 
			
		||||
 | 
			
		||||
      uint32 A = 0, B = 0, C = 0, D = 0;
 | 
			
		||||
      // A is just the lsb replicated 8 times.
 | 
			
		||||
      for(uint32 i = 0; i < 9; i++) {
 | 
			
		||||
        A |= bitval & 1;
 | 
			
		||||
        A <<= 1;
 | 
			
		||||
      }
 | 
			
		||||
      // A is just the lsb replicated 9 times.
 | 
			
		||||
      A = FasTC::Replicate(bitval & 1, 1, 9);
 | 
			
		||||
 | 
			
		||||
      switch(val.GetEncoding()) {
 | 
			
		||||
        // Replicate bits
 | 
			
		||||
        case eIntegerEncoding_JustBits: {
 | 
			
		||||
          uint32 result = bitval;
 | 
			
		||||
          uint32 resultLen = bitlen;
 | 
			
		||||
          while(resultLen < 8) {
 | 
			
		||||
            result <<= bitlen;
 | 
			
		||||
            result |= bitval & ((1 << std::min(8 - bitlen, bitlen)) - 1);
 | 
			
		||||
            resultLen += bitlen;
 | 
			
		||||
          }
 | 
			
		||||
          out[outIdx++] = result;
 | 
			
		||||
        }
 | 
			
		||||
        case eIntegerEncoding_JustBits: 
 | 
			
		||||
          out[outIdx++] = FasTC::Replicate(bitval, bitlen, 8);
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
        // Use algorithm in C.2.13
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue