MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / bsf

Method bsf

tools/x86/src/x86/Bit.java:202–243  ·  view source on GitHub ↗
(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, FileOutputStream fosOps_h, FileOutputStream fosOps_cpp, String bits, String functionName, String enumName, String load, boolean eaa)

Source from the content-addressed store, hash-verified

200 }
201
202 public void bsf(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, FileOutputStream fosOps_h, FileOutputStream fosOps_cpp, String bits, String functionName, String enumName, String load, boolean eaa) throws IOException {
203 if (eaa) {
204 out(fosOps_h, "void common_" + functionName + "(CPU* cpu, U32 address, U32 dstReg);");
205 out(fosOps_cpp, "void common_" + functionName + "(CPU* cpu, U32 address, U32 dstReg) {");
206 } else {
207 out(fosOps_h, "void common_" + functionName + "(CPU* cpu, U32 srcReg, U32 dstReg);");
208 out(fosOps_cpp, "void common_" + functionName + "(CPU* cpu, U32 srcReg, U32 dstReg) {");
209 }
210 out(fosOps_cpp, " U"+bits+" value="+load+";");
211 out(fosOps_cpp, " cpu->fillFlagsNoZF();");
212 out(fosOps_cpp, " if (value==0) {");
213 out(fosOps_cpp, " cpu->addZF();");
214 out(fosOps_cpp, " } else {");
215 out(fosOps_cpp, " U"+bits+" result = 0;");
216 out(fosOps_cpp, " while ((value & 0x01)==0) { result++; value>>=1; }");
217 out(fosOps_cpp, " cpu->removeZF();");
218 out(fosOps_cpp, " cpu->reg[dstReg].u"+bits+"=result;");
219 out(fosOps_cpp, " }");
220 out(fosOps_cpp, "}");
221
222 out(fos, "void OPCALL normal_"+functionName+"(CPU* cpu, DecodedOp* op) {");
223 out(fos, " START_OP(cpu, op);");
224 if (eaa) {
225 out(fos, " common_"+functionName+"(cpu, eaa(cpu, op), op->reg);");
226 } else {
227 out(fos, " common_"+functionName+"(cpu, op->rm, op->reg);");
228 }
229 out(fos, " NEXT();");
230 out(fos, "}");
231 out(fos_init, "INIT_CPU("+enumName+", "+functionName+")");
232
233 out(fos32, "void dynamic_"+functionName+"(DynamicData* data, DecodedOp* op) {");
234 if (eaa) {
235 out(fos32, " calculateEaa(op, DYN_ADDRESS);");
236 out(fos32, " callHostFunction(common_" + functionName + ", false, 3, 0, DYN_PARAM_CPU, false, DYN_ADDRESS, DYN_PARAM_REG_32, true, op->reg, DYN_PARAM_CONST_32, false);");
237 } else {
238 out(fos32, " callHostFunction(common_" + functionName + ", false, 3, 0, DYN_PARAM_CPU, false, op->rm, DYN_PARAM_CONST_32, false, op->reg, DYN_PARAM_CONST_32, false);");
239 }
240 out(fos32, " data->currentLazyFlags=FLAGS_NONE;");
241 out(fos32, " INCREMENT_EIP(op->len);");
242 out(fos32, "}");
243 }
244
245 public void bsr(FileOutputStream fos, FileOutputStream fos_init, FileOutputStream fos32, FileOutputStream fosOps_h, FileOutputStream fosOps_cpp, String bits, String functionName, String enumName, String load, boolean eaa) throws IOException {
246 if (eaa) {

Callers 3

generateAllMethod · 0.95
bsfRegMethod · 0.80

Calls 1

outMethod · 0.45

Tested by

no test coverage detected