MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / getBits32

Function getBits32

pcsx2/IPU/IPU_MultiISA.cpp:149–171  ·  view source on GitHub ↗

whenever reading fractions of bytes. The low bits always come from the next byte while the high bits come from the current byte

Source from the content-addressed store, hash-verified

147// whenever reading fractions of bytes. The low bits always come from the next byte
148// while the high bits come from the current byte
149__ri static u8 getBits32(u8 *address, bool advance)
150{
151 if (!g_BP.FillBuffer(32)) return 0;
152
153 const u8* readpos = &g_BP.internal_qwc->_u8[g_BP.BP/8];
154
155 if(uint shift = (g_BP.BP & 7))
156 {
157 u32 mask = (0xff >> shift);
158 mask = mask | (mask << 8) | (mask << 16) | (mask << 24);
159
160 *(u32*)address = ((~mask & *(u32*)(readpos + 1)) >> (8 - shift)) | (((mask) & *(u32*)readpos) << shift);
161 }
162 else
163 {
164 // Bit position-aligned -- no masking/shifting necessary
165 *(u32*)address = *(u32*)readpos;
166 }
167
168 if (advance) g_BP.Advance(32);
169
170 return 1;
171}
172
173__ri static u8 getBits8(u8 *address, bool advance)
174{

Callers 4

mpeg2sliceIDECFunction · 0.70
mpeg2_sliceFunction · 0.70
ipuVDECFunction · 0.70
ipuFDECFunction · 0.70

Calls 2

FillBufferMethod · 0.80
AdvanceMethod · 0.45

Tested by

no test coverage detected