problem
stringlengths
26
131k
labels
class label
2 classes
GHC: Are there consistent rules for memoization for calls with fixed values? : <p>In my quest to understand and harness GHC automatic memoization, I've hit a wall: when pure functions are called with fixed values like <code>fib 42</code>, they are sometimes fast and sometimes slow when called again. It varies if they're called plainly like <code>fib 42</code> or implicitly through some math, e.g. <code>(\x -&gt; fib (x - 1)) 43</code>. The cases have no seeming rhyme or reason, so I'll present them with the intention of asking what the logic is behind the behavior.</p> <p>Consider a slow Fibonacci implementation, which makes it obvious when the memoization is working:</p> <pre><code>slow_fib :: Int -&gt; Integer slow_fib n = if n &lt; 2 then 1 else (slow_fib (n - 1)) + (slow_fib (n - 2)) </code></pre> <p>I tested three basic questions to see if GHC (version 8.2.2) will memoize calls with fixed args:</p> <ol> <li>Can <code>slow_fib</code> access previous top-level calls to <code>slow_fib</code>?</li> <li>Are previous results memoized for later non-trivial (e.g. math) top-level expressions?</li> <li>Are previous results memoized for later identical top-level expressions?</li> </ol> <p>The answers seem to be:</p> <ol> <li>No</li> <li>No</li> <li>Yes [??]</li> </ol> <p>The fact that the last case works is very confusing to me: if I can reprint the result for example, then I should expect to be able to add them. Here's the code that shows this:</p> <pre><code>main = do -- 1. all three of these are slow, even though `slow_fib 37` is -- just the sum of the other two results. Definitely no memoization. putStrLn $ show $ slow_fib 35 putStrLn $ show $ slow_fib 36 putStrLn $ show $ slow_fib 37 -- 2. also slow, definitely no memoization as well. putStrLn $ show $ (slow_fib 35) + (slow_fib 36) + (slow_fib 37) putStrLn $ show $ (slow_fib 35) + 1 -- 3. all three of these are instant. Huh? putStrLn $ show $ slow_fib 35 putStrLn $ show $ slow_fib 36 putStrLn $ show $ slow_fib 37 </code></pre> <hr> <p>Yet stranger, doing math on the results worked when it's embedded in a recursive function: this fibonacci variant that starts at Fib(40):</p> <pre><code>let fib_plus_40 n = if n &lt;= 0 then slow_fib 40 else (fib_plus_40 (n - 1)) + (fib_plus_40 (n - 2)) </code></pre> <p>Shown by the following:</p> <pre><code>main = do -- slow as expected putStrLn $ show $ fib_plus_40 0 -- instant. Why?! putStrLn $ show $ fib_plus_40 1 </code></pre> <p>I can't find any reasoning for this in any explanations for GHC memoization, which typically incriminate explicit variables (e.g. <a href="https://stackoverflow.com/questions/11466284/how-is-this-fibonacci-function-memoized">here</a>, <a href="https://stackoverflow.com/questions/34644761/haskell-memoization">here</a>, <a href="https://stackoverflow.com/questions/38167078/does-this-haskell-function-memoize">and here</a>). This is why I expected <code>fib_plus_40</code> to fail to memoize.</p>
0debug
onDestroy() doesn't work : <p>when i run my app,at the start, all checkbox are select in <code>list view</code>...so i must unchecked before all checkbox....i don't know why..... Maybe i wrong to write <code>onDestroy</code> method....</p> <p>Please help me!</p> <p>i show you my code... THANKS IN ADVANCE EVERYBODY!</p> <p>ADAPTER:</p> <pre><code>public abstract class PlanetAdapter extends ArrayAdapter&lt;Planet&gt; implements CompoundButton.OnCheckedChangeListener { private List&lt;Planet&gt; planetList = null; private Context context = null; ArrayList&lt;Birra&gt; objects; private HashMap&lt;Integer, Planet&gt; pizzaSelected = new HashMap&lt;&gt;(); public boolean Checked; public PlanetAdapter(List&lt;Planet&gt; planetList, Context context) { super(context, R.layout.single_listview_item, planetList); this.planetList = planetList; this.context = context; } public class PlanetHolder { public TextView planetName; public TextView distView; public TextView valuta; public CheckBox chkBox; public EditText edit; //public String quantità; public boolean checked; public TextView id; } @Override public int getCount() { return planetList.size(); } @Override public Planet getItem(int position) { return planetList.get(position); } @Override public long getItemId(int position) { return planetList.get(position).getId(); } @Override public View getView(final int position, View convertView, ViewGroup parent) { View row = convertView; PlanetHolder holder = null; if (row == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); row = inflater.inflate(R.layout.single_listview_item, parent, false); holder = new PlanetHolder(); holder.planetName = (TextView) row.findViewById(R.id.name); holder.distView = (TextView) row.findViewById(R.id.dist); holder.valuta = (TextView) row.findViewById(R.id.valuta); holder.chkBox = (CheckBox) row.findViewById(R.id.chk_box); holder.edit = (EditText) row.findViewById(R.id.editText); holder.edit.setVisibility(View.GONE); holder.edit.setEnabled(false); // holder.id = (TextView) row.findViewById(R.id.id); row.setTag(holder); } else { holder = (PlanetHolder) row.getTag(); } final Planet p = planetList.get(position); holder.planetName.setText(p.getName()); holder.distView.setText("" + p.getDistance()); holder.valuta.setText("" + p.getValuta()); holder.chkBox.setChecked(p.isSelected()); holder.chkBox.setTag(p); holder.edit.setEnabled(false); SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); boolean isChecked = states.getBoolean("holder.chkBox" + holder.planetName.getText().toString(), false); System.out.println(isChecked); if (isChecked) { holder.chkBox.setChecked(true); holder.edit.setVisibility(View.VISIBLE); holder.edit.setEnabled(true); SharedPreferences statess = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); String string = statess.getString("finalHolder.edit" + holder.planetName.getText().toString(), holder.edit.getText().toString().trim()); holder.edit.setText(string); } else { holder.chkBox.setChecked(false); holder.edit.setVisibility(View.GONE); holder.edit.setEnabled(false); } holder.chkBox.setOnCheckedChangeListener(PlanetAdapter.this); // final BirraHolder finalHolder = birraHolder; final PlanetHolder finalHolder = holder; holder.chkBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (finalHolder.chkBox.isChecked()) { finalHolder.edit.setVisibility(View.VISIBLE); finalHolder.edit.setEnabled(true); SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor = states.edit(); editor.putBoolean("holder.chkBox" + finalHolder.planetName.getText().toString(), true); editor.commit(); finalHolder.edit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { p.setQuantità(finalHolder.edit.getText().toString().trim()); SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor = states.edit(); editor.putString("finalHolder.edit" + finalHolder.planetName.getText().toString(), finalHolder.edit.getText().toString().trim()); editor.commit(); } }); /* SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor = states.edit(); editor.putBoolean("holder.chkBox" + finalHolder.planetName.getText().toString(), true); editor.commit();*/ //Utility.putPizzaItem(p); //Utility.getPizzaItem(p); } else { SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor3 = states.edit(); finalHolder.edit.setVisibility(View.GONE); finalHolder.edit.setEnabled(false); finalHolder.edit.setText(""); /* editor3.putBoolean("holder.chkBox" + finalHolder.planetName.getText().toString(), false); editor3.commit(); */ } /* SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor = states.edit(); editor.apply();*/ } }); /*holder.chkBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (finalHolder.chkBox.isChecked()) { finalHolder.edit.setVisibility(View.VISIBLE); finalHolder.edit.setEnabled(true); SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor = states.edit(); editor.putBoolean("holder.chkBox", true); //pizzaSelected.put(p.getId(), p); System.out.println(p.getId()); } else { finalHolder.edit.setVisibility(View.GONE); finalHolder.edit.setEnabled(false); finalHolder.edit.setText(null); pizzaSelected.remove(p.getId()); } } }); */ /* finalHolder.edit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { p.setQuantità(finalHolder.edit.getText().toString().trim()); SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE); SharedPreferences.Editor editor = states.edit(); editor.putString("finalHolder.edit" + finalHolder.planetName.getText().toString(), finalHolder.edit.getText().toString().trim()); editor.commit(); } }); */ // holder.planetName.setText(p.getName()); // holder.distView.setText("" + p.getDistance()); // holder.valuta.setText("" + p.getValuta()); // holder.chkBox.setChecked(p.isSelected()); // holder.chkBox.setTag(p); // holder.edit.setEnabled(false); // holder.id.setId(p.getId()); return row; } ArrayList&lt;Planet&gt; getBox() { ArrayList&lt;Planet&gt; box = new ArrayList&lt;Planet&gt;(); for (Planet p : planetList) { if (p.isSelected()) box.add(p); } return box; } } </code></pre> <p>FRAGMENT:</p> <pre><code>public class MyListFragment extends Fragment implements android.widget.CompoundButton.OnCheckedChangeListener { ListView lv; ArrayList&lt;Planet&gt; planetList; static PlanetAdapter plAdapter; BirraAdapter biAdapter; PlanetAdapter.PlanetHolder holder; private static Context context = null; private static FragmentActivity mInstance; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_list2, container, false); context = getActivity(); mInstance= getActivity(); Button mButton = (Button) rootView.findViewById(R.id.button); mButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showResult(v); } }); //return inflater.inflate(R.layout.fragment_list2, container, false); return rootView; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); lv = (ListView)getView().findViewById(R.id.listview); displayPlanetList(); } private void displayPlanetList() { planetList = new ArrayList&lt;Planet&gt;(); planetList.add(new Planet("Margherita", 6, "€",1)); planetList.add(new Planet("Diavola", 7,"€",2)); planetList.add(new Planet("Bufalina", 5,"€",3)); planetList.add(new Planet("Marinara", 5, "€",4)); planetList.add(new Planet("Viennese", 4, "€", 5)); plAdapter = new PlanetAdapter(planetList, getContext()) { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { int pos = lv.getPositionForView(buttonView); if (pos != ListView.INVALID_POSITION) { Planet p = planetList.get(pos); p.setSelected(isChecked); /*Toast.makeText( getActivity(), "Clicked on Pizza: " + p.getName() + ". State: is " + isChecked, Toast.LENGTH_SHORT).show();*/ } } }; lv.setAdapter(plAdapter); } public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { /*int pos = lv.getPositionForView(buttonView); if (pos != ListView.INVALID_POSITION) { Planet p = planetList.get(pos); p.setSelected(isChecked); *//*Toast.makeText( getActivity(), "Clicked on Planet: " + p.getName() + ". State: is " + isChecked, Toast.LENGTH_SHORT).show();*//* }*/ } /* public static void showResult(View v) { String result = "Selected Product are :"; int totalAmount=0; String result2 = ""; int totalAmount2=0; String a=""; String z=""; for (Planet p : plAdapter.getBox()) { if (p.isSelected()){ result2 += "\n" + p.getName()+" "+p.getDistance()+"€"+"q.tà :"+p.getQuantità(); int quantitaInt= Integer.parseInt(p.getQuantità() ); totalAmount2+=p.getDistance() * quantitaInt; //z=String.valueOf(totalAmount2); } int totale=totalAmount+totalAmount2; z=String.valueOf(totale); } Toast.makeText(context, result2 + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show(); //Toast.makeText(getActivity(), result2 + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show(); Bundle bun2 = new Bundle(); bun2.putString("scelta", result2); ThreeFragment fgsearch2 = new ThreeFragment(); fgsearch2.setArguments(bun2); android.support.v4.app.FragmentTransaction transaction2 = mInstance.getSupportFragmentManager().beginTransaction(); transaction2.replace(R.id.content_main, fgsearch2); transaction2.commit(); */ /* } */ public static void showResult(View v) { String result = "Selected Product are :"; int totalAmount=0; String result2 = ""; int totalAmount2=0; String a=""; //String z=""; for (Planet p : plAdapter.getBox()) { if (p.isSelected()){ result += "\n" + p.getName()+" "+p.getDistance()+"€"+"q.tà :"+p.getQuantità(); int quantitaInt= Integer.parseInt(p.getQuantità() ); totalAmount2+=p.getDistance() * quantitaInt; //z=String.valueOf(totalAmount2); } } Toast.makeText(context, result + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show(); //Toast.makeText(getActivity(), result2 + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show(); Bundle bun2 = new Bundle(); bun2.putString("scelta3", result); TwoFragment fgsearch2 = new TwoFragment(); fgsearch2.setArguments(bun2); android.support.v4.app.FragmentTransaction transaction2 = mInstance.getSupportFragmentManager().beginTransaction(); transaction2.replace(R.id.content_main3, fgsearch2); transaction2.commit(); /*Bundle bun = new Bundle(); // bun.putString("totalepizze",z); bun.putInt("totalepizze",totalAmount2); TwoFragment fgsearch = new TwoFragment(); fgsearch.setArguments(bun); android.support.v4.app.FragmentTransaction transaction = mInstance.getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_main2, fgsearch); transaction.commit();*/ /* Bundle bun = new Bundle(); bun.putString("scelta", result2); TwoFragment fgsearch = new TwoFragment(); fgsearch.setArguments(bun); android.support.v4.app.FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_main2, fgsearch); transaction.commit(); */ } } </code></pre> <p>ACTIVITY:</p> <pre><code>public class Main extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); getSupportFragmentManager().beginTransaction(). replace(R.id.fragmentContainer, new MyListFragment()).commit(); } @Override public void onDestroy() { super.onDestroy(); SharedPreferences myPrefs = this.getSharedPreferences("states", Context.MODE_PRIVATE); myPrefs.edit().remove("states"); myPrefs.edit().clear(); myPrefs.edit().commit(); } } </code></pre> <p>LOGCAT:</p> <pre><code>05-22 13:40:33.781 12076-12076/? D/dalvikvm: Not late-enabling CheckJNI (already on) 05-22 13:40:34.831 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:35.190 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:35.331 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:35.411 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:35.761 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:35.810 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:35.871 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;) 05-22 13:40:35.880 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested 05-22 13:40:35.880 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve interface method 18907: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z 05-22 13:40:35.880 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 05-22 13:40:35.890 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode 05-22 13:40:35.890 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve interface method 18911: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode; 05-22 13:40:35.890 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 05-22 13:40:36.191 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged 05-22 13:40:36.221 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve virtual method 18802: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V 05-22 13:40:36.221 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007 05-22 13:40:36.281 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:36.351 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations 05-22 13:40:36.351 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve virtual method 442: Landroid/content/res/TypedArray;.getChangingConfigurations ()I 05-22 13:40:36.351 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 05-22 13:40:36.361 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType 05-22 13:40:36.371 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve virtual method 464: Landroid/content/res/TypedArray;.getType (I)I 05-22 13:40:36.371 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 05-22 13:40:36.401 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:36.531 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.widget.LinearLayout$LayoutParams.&lt;init&gt;, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.&lt;init&gt; 05-22 13:40:36.561 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve direct method 19435: Landroid/widget/LinearLayout$LayoutParams;.&lt;init&gt; (Landroid/widget/LinearLayout$LayoutParams;)V 05-22 13:40:36.561 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x70 at 0x0000 05-22 13:40:36.561 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.widget.LinearLayout$LayoutParams.&lt;init&gt;, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.&lt;init&gt; 05-22 13:40:36.571 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve direct method 19435: Landroid/widget/LinearLayout$LayoutParams;.&lt;init&gt; (Landroid/widget/LinearLayout$LayoutParams;)V 05-22 13:40:36.571 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x70 at 0x0000 05-22 13:40:36.771 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:36.771 12076-12079/info.androidhive.materialtabs D/dalvikvm: GC_CONCURRENT freed 217K, 3% free 12838K/13127K, paused 14ms+6ms 05-22 13:40:36.841 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:36.970 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable 05-22 13:40:36.970 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve virtual method 405: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable; 05-22 13:40:36.970 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 05-22 13:40:36.970 12076-12076/info.androidhive.materialtabs I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity 05-22 13:40:36.980 12076-12076/info.androidhive.materialtabs W/dalvikvm: VFY: unable to resolve virtual method 407: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable; 05-22 13:40:36.980 12076-12076/info.androidhive.materialtabs D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 05-22 13:40:37.261 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:37.330 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:37.671 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for TwoFragment{4160a840 #1 id=0x7f0c006b android:switcher:2131492971:1} not updated inline; expected state 3 found 2 05-22 13:40:37.701 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for ThreeFragment{41676830 #2 id=0x7f0c006b android:switcher:2131492971:2} not updated inline; expected state 3 found 2 05-22 13:40:37.711 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for FourFragment{41639f98 #3 id=0x7f0c006b android:switcher:2131492971:3} not updated inline; expected state 3 found 2 05-22 13:40:37.731 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for FiveFragment{4160d458 #4 id=0x7f0c006b android:switcher:2131492971:4} not updated inline; expected state 3 found 2 05-22 13:40:37.741 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for SixFragment{4164fde0 #5 id=0x7f0c006b android:switcher:2131492971:5} not updated inline; expected state 3 found 2 05-22 13:40:37.771 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:37.811 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for SevenFragment{41660860 #6 id=0x7f0c006b android:switcher:2131492971:6} not updated inline; expected state 3 found 2 05-22 13:40:37.832 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:37.861 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for EightFragment{41654958 #7 id=0x7f0c006b android:switcher:2131492971:7} not updated inline; expected state 3 found 2 05-22 13:40:37.891 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for NineFragment{41643a90 #8 id=0x7f0c006b android:switcher:2131492971:8} not updated inline; expected state 3 found 2 05-22 13:40:37.911 12076-12076/info.androidhive.materialtabs W/FragmentManager: moveToState: Fragment state for TenFragment{41614fa8 #9 id=0x7f0c006b android:switcher:2131492971:9} not updated inline; expected state 3 found 2 05-22 13:40:38.270 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:38.331 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:38.481 12076-12076/info.androidhive.materialtabs I/System.out: true 05-22 13:40:38.641 12076-12079/info.androidhive.materialtabs D/dalvikvm: GC_CONCURRENT freed 139K, 2% free 13161K/13383K, paused 6ms+6ms 05-22 13:40:38.781 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:38.861 12076-12076/info.androidhive.materialtabs I/System.out: true 05-22 13:40:38.871 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:39.010 12076-12076/info.androidhive.materialtabs I/System.out: true 05-22 13:40:39.100 12076-12076/info.androidhive.materialtabs I/System.out: true 05-22 13:40:39.171 12076-12076/info.androidhive.materialtabs I/System.out: true 05-22 13:40:39.290 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:39.311 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:39.771 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:39.811 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' 05-22 13:40:40.150 12076-12076/info.androidhive.materialtabs D/gralloc_goldfish: Emulator without GPU emulation detected. 05-22 13:40:40.280 12076-12081/info.androidhive.materialtabs I/dalvikvm: threadid=3: reacting to signal 3 05-22 13:40:40.311 12076-12081/info.androidhive.materialtabs I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt' </code></pre>
0debug
how to turn this "for" loop into a recursion (java)? : This is my code that generates any possible permutation in the given length (n) from string s (the abc): public String binary (int n, String str, int i){ String s="abcdefghijklmnopqrstuvwxyz"; //i=s.length(); if (n==0){ System.out.println(str); return str;} if (i==s.length()){ System.out.println(str); return "";} for (i=0;i<26;i++){ binary (n-1,str+s.charAt(i), i);} return ""; } My question is how to convert my "for" loop into a recursion? I am not allowed to use any loops in my homework. Thanks!
0debug
Convert URLs to another in PHP : <p>How I can convert URL to another use PHP exemple</p> <pre><code>domain.com to domain2.com </code></pre> <p>and</p> <pre><code>domain.com/content to cdn.domain2.com </code></pre>
0debug
ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style) { ASS *ass = &ctx->ass; int i; if (!style || !*style) style = "Default"; for (i=0; i<ass->styles_count; i++) if (!strcmp(ass->styles[i].name, style)) return ass->styles + i; return NULL; }
1threat
Weird Behavior with Java Objects: Supposedly the same process, different result : I am in dire need of help involving this weird behavior in Java Objects. I have this ComponentPlane.class with two different versions. Difference is marked by (******) First WORKING Version package app.pathsom.som.output; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JPanel; import app.pathsom.som.map.Lattice; import app.pathsom.som.map.Node; public class ComponentPlane extends JPanel{ private Lattice lattice; private int componentNumber; private double minValue; private double maxValue; private double origMinValue; private double origMaxValue; public ComponentPlane(Lattice lattice, int componentNumber){ this.lattice = new Lattice(); this.componentNumber = componentNumber; initLattice(lattice); initComponentPlane(); } private void initLattice(Lattice lattice){ this.lattice.setLatticeHeight(lattice.getLatticeHeight()); this.lattice.setLatticeWidth(lattice.getLatticeWidth()); this.lattice.setNumberOfNodeElements(lattice.getNumberOfNodeElements()); this.lattice.initializeValues(); this.lattice.setNodeHeight(lattice.getNodeHeight()); this.lattice.setNodeWidth(lattice.getNodeWidth()); this.lattice.setTotalNumberOfNodes(lattice.getTotalNumberOfNodes()); for(int i = 0; i < lattice.getTotalNumberOfNodes(); i++){ ******this.lattice.getLatticeNode()[i] = new Node(lattice.getLatticeNode()[i]);****** } } public Lattice getLattice(){ return lattice; } private void initComponentPlane(){ maxValue = lattice.getLatticeNode()[0].getDoubleElementAt(componentNumber); minValue = lattice.getLatticeNode()[0].getDoubleElementAt(componentNumber); for(int i = 1; i < lattice.getTotalNumberOfNodes(); i++){ if(lattice.getLatticeNode()[i].getDoubleElementAt(componentNumber) < minValue){ minValue = lattice.getLatticeNode()[i].getDoubleElementAt(componentNumber); } if(lattice.getLatticeNode()[i].getDoubleElementAt(componentNumber) > maxValue){ maxValue = lattice.getLatticeNode()[i].getDoubleElementAt(componentNumber); } } for(int i = 0; i < lattice.getTotalNumberOfNodes(); i++){ Node currNode = lattice.getLatticeNode()[i]; int colorValue = (int)Math.round((currNode.getDoubleElementAt(componentNumber) - minValue) / (maxValue - minValue) * 1020); Color nodeColor = new Color(0); int caseValue = colorValue/256; if(caseValue == 0) nodeColor = new Color(0, (colorValue % 256), 255); else if(caseValue == 1) nodeColor = new Color(0, 255, 255 - (colorValue % 256)); else if (caseValue == 2) nodeColor = new Color((colorValue % 256), 255, 0); else nodeColor = new Color(255, 255 - (colorValue % 256), 0); lattice.getLatticeNode()[i].setNodeColor(nodeColor); } } public double getMaxValue(){ return maxValue; } public double getMinValue(){ return minValue; } public void setOrigMaxMin(double maxValue, double minValue){ this.origMaxValue = this.maxValue * (maxValue - minValue) + minValue; this.origMinValue = this.minValue * (maxValue - minValue) + minValue; } public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.scale(0.5, 0.5); System.out.print("component: " + componentNumber); for(int i = 0; i < lattice.getTotalNumberOfNodes(); i++){ g.setColor(lattice.getLatticeNode()[i].getNodeColor()); g.fillRect(lattice.getLatticeNode()[i].getxPos() - lattice.getNodeWidth() /2, lattice.getLatticeNode()[i].getyPos() - lattice.getNodeHeight() /2 , lattice.getNodeWidth(), lattice.getNodeHeight()); g.setColor(Color.BLACK); g.drawRect(lattice.getLatticeNode()[i].getxPos() - lattice.getNodeWidth() /2, lattice.getLatticeNode()[i].getyPos() - lattice.getNodeHeight() /2 , lattice.getNodeWidth(), lattice.getNodeHeight()); } System.out.println(); g.setColor(Color.BLACK); double hund = 100; int intMaxValue = (int) (origMaxValue*hund); int intMinValue = (int) (origMinValue*hund); g.setFont(new Font("Arial", Font.PLAIN, 18)); g.drawString(Double.toString(intMinValue/hund), 0, 470); g.drawString(Double.toString(intMaxValue/hund), 405, 470); for(int i = 0; i < 1024; i++){ if(i < 256) g.setColor(new Color(0, (i % 256), 255)); else if(i < 512) g.setColor(new Color(0, 255, 255 - (i % 256))); else if(i < 768) g.setColor(new Color((i % 256), 255, 0)); else g.setColor(new Color(255, 255 - (i % 256), 0)); double width = 350; g.fillRect((int)Math.ceil(i * width/1024) + 50, 455, (int)Math.ceil(width/1024), 15); } g.setColor(Color.BLACK); g.drawRect(50, 455, 350, 15); } } The only difference of the second NON-WORKING version is with this FUNCTION REPLACING the FUNCTION above private void initLattice(Lattice lattice){ this.lattice.setLatticeHeight(lattice.getLatticeHeight()); this.lattice.setLatticeWidth(lattice.getLatticeWidth()); this.lattice.setNumberOfNodeElements(lattice.getNumberOfNodeElements()); this.lattice.initializeValues(); this.lattice.setNodeHeight(lattice.getNodeHeight()); this.lattice.setNodeWidth(lattice.getNodeWidth()); this.lattice.setTotalNumberOfNodes(lattice.getTotalNumberOfNodes()); for(int i = 0; i < lattice.getTotalNumberOfNodes(); i++){ ******this.lattice.getLatticeNode()[i] = lattice.getLatticeNode()[i];****** } } I have also tried doing a third non-working version which is... private void initLattice(Lattice lattice){ this.lattice.setLatticeHeight(lattice.getLatticeHeight()); this.lattice.setLatticeWidth(lattice.getLatticeWidth()); this.lattice.setNumberOfNodeElements(lattice.getNumberOfNodeElements()); this.lattice.initializeValues(); this.lattice.setNodeHeight(lattice.getNodeHeight()); this.lattice.setNodeWidth(lattice.getNodeWidth()); this.lattice.setTotalNumberOfNodes(lattice.getTotalNumberOfNodes()); ******this.lattice.setLatticeNode(lattice.getLatticeNode());****** } A Constructor in the Node.class (WHICH is USED in the first WORKING version is this one... public Node (Node node){ this.xPos = node.xPos; this.yPos = node.yPos; this.numOfElements = node.numOfElements; this.cluster = -1; this.nodeIndex = node.getNodeIndex(); for(int i = 0; i < this.numOfElements; i++){ this.addElement(node.getDoubleElementAt(i)); } } My problems are - The First one works FINE. It creates HEATMAPS or COMPONENTPLANES for EACH component number (meaning they differ from each other) BUT I cannot USE it AS the LINE with ****** which references to the ("this.addElement....") in the Node.class constructor gives me OUTOFMEMORY error so it LAGS and FREEZES whenever I have many COMPONENTPLANES to do. (I am actually doing an ARRAY of COMPONENTPlane objects) so I decided to try the second and third option. I have already increased my heap size SO this is OUT of the question - If I use the second and third one, I end up with no LAGS even with large amount of ComponentPlanes (probably less memory taking up because of creating new Node objects or idk) BUT these CREATES WRONG HEATMAPS. All heatmaps are the same. And the thing is, all heatmaps are LIKE the LAST ELEMENT of the ComponentPlanes array (e.g. if i have TEN ComponentPlane objects, all heatmaps look exactly like the TENTH Component Object) This is an image... [All of the heatmaps are like this - the same as the last heatmap in the array][1] is there a way to make the second and third one work? Thank you. I hope you can help me as I really need to finish this one asap so i can proceed on the bigger modules of the project. Thank you. [1]: https://i.stack.imgur.com/GPXfM.png
0debug
Remove some code lines in production distribution files? : <p>I'm using <code>Babel</code> and <code>Webpack</code> to generate <code>ES5</code> code from <code>ES6</code>. There are some validations that is used to reduce the mistakes i do while coding.</p> <pre><code>class Logger { /** * @param {LogModel} info * {LogTypes} type * {String} message * {Date} date */ static log(info) { if(info instanceof LogModel) throw new Error("not a instance of LogModel"); notify(info); } } </code></pre> <p>In <code>log</code> function, I validate whether the argument is a instance of <code>LogModel</code> class. This is just to prevent mistakes. I don't want that if condition to be in the production because too many if condition going to slow the application. Is it possible to generate development release with validations and production release without those validations with <code>Babel</code> and <code>Webpack</code>?</p>
0debug
static void kvm_handle_internal_error(CPUState *env, struct kvm_run *run) { if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) { int i; fprintf(stderr, "KVM internal error. Suberror: %d\n", run->internal.suberror); for (i = 0; i < run->internal.ndata; ++i) { fprintf(stderr, "extra data[%d]: %"PRIx64"\n", i, (uint64_t)run->internal.data[i]); } } cpu_dump_state(env, stderr, fprintf, 0); if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) { fprintf(stderr, "emulation failure\n"); if (!kvm_arch_stop_on_emulation_error(env)) { return; } } vm_stop(0); }
1threat
Android Disable External Speaker and Inbuilt Speaker allow only earphone to watch video or listen Audio : I have some videos of which audios sound should be available only through earphone. not from inbuilt speaker or external speakers. NOTE: it should not allow External Speakers with 3.5mm jack. What is the possibility to solve it. It will be great if anybody help me out with this.
0debug
def super_seq(X, Y, m, n): if (not m): return n if (not n): return m if (X[m - 1] == Y[n - 1]): return 1 + super_seq(X, Y, m - 1, n - 1) return 1 + min(super_seq(X, Y, m - 1, n), super_seq(X, Y, m, n - 1))
0debug
Runtime error with Angular 9 and Ivy: Cannot read property 'id' of undefined ; Zone : <p>We have an Angular 8 project with tests. We are attempting to upgrade to Angular 9 and went through all the steps in <a href="https://update.angular.io/#8.0:9.0l3" rel="noreferrer">https://update.angular.io/#8.0:9.0l3</a>. This all went smoothly, no issues. The app compiles with no errors and all of the tests run fine. We are getting this error at runtime. When we turn off Ivy, it runs fine so definitely seems related to Ivy. </p> <pre><code>zone-evergreen.js:659 Unhandled Promise rejection: Cannot read property 'id' of undefined ; Zone: &lt;root&gt; ; Task: Promise.then ; Value: TypeError: Cannot read property 'id' of undefined at registerNgModuleType (core.js:35467) at core.js:35485 at Array.forEach (&lt;anonymous&gt;) at registerNgModuleType (core.js:35481) at core.js:35485 at Array.forEach (&lt;anonymous&gt;) at registerNgModuleType (core.js:35481) at new NgModuleFactory$1 (core.js:35649) at compileNgModuleFactory__POST_R3__ (core.js:41403) at PlatformRef.bootstrapModule (core.js:41768) TypeError: Cannot read property 'id' of undefined at registerNgModuleType (http://localhost:8080/vendor.js:41436:27) at http://localhost:8080/vendor.js:41454:14 at Array.forEach (&lt;anonymous&gt;) at registerNgModuleType (http://localhost:8080/vendor.js:41450:17) at http://localhost:8080/vendor.js:41454:14 at Array.forEach (&lt;anonymous&gt;) at registerNgModuleType (http://localhost:8080/vendor.js:41450:17) at new NgModuleFactory$1 (http://localhost:8080/vendor.js:41602:13) at compileNgModuleFactory__POST_R3__ (http://localhost:8080/vendor.js:46530:27) at PlatformRef.bootstrapModule (http://localhost:8080/vendor.js:46859:16) </code></pre>
0debug
Why does a GraphQL query return null? : <p>I have an <code>graphql</code>/<code>apollo-server</code>/<code>graphql-yoga</code> endpoint. This endpoint exposes data returned from a database (or a REST endpoint or some other service).</p> <p>I know my data source is returning the correct data -- if I log the result of the call to the data source inside my resolver, I can see the data being returned. However, my GraphQL field(s) always resolve to null.</p> <p>If I make the field non-null, I see the following error inside the <code>errors</code> array in the response:</p> <blockquote> <p>Cannot return null for non-nullable field</p> </blockquote> <p>Why is GraphQL not returning the data?</p>
0debug
size_t qcrypto_hash_digest_len(QCryptoHashAlgorithm alg) { if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_size)) { return 0; } return qcrypto_hash_alg_size[alg]; }
1threat
static int read_access_unit(AVCodecContext *avctx, void* data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MLPDecodeContext *m = avctx->priv_data; GetBitContext gb; unsigned int length, substr; unsigned int substream_start; unsigned int header_size = 4; unsigned int substr_header_size = 0; uint8_t substream_parity_present[MAX_SUBSTREAMS]; uint16_t substream_data_len[MAX_SUBSTREAMS]; uint8_t parity_bits; int ret; if (buf_size < 4) return AVERROR_INVALIDDATA; length = (AV_RB16(buf) & 0xfff) * 2; if (length < 4 || length > buf_size) return AVERROR_INVALIDDATA; init_get_bits(&gb, (buf + 4), (length - 4) * 8); m->is_major_sync_unit = 0; if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) { if (read_major_sync(m, &gb) < 0) m->is_major_sync_unit = 1; header_size += m->major_sync_header_size; if (!m->params_valid) { av_log(m->avctx, AV_LOG_WARNING, "Stream parameters not seen; skipping frame.\n"); *got_frame_ptr = 0; return length; substream_start = 0; for (substr = 0; substr < m->num_substreams; substr++) { int extraword_present, checkdata_present, end, nonrestart_substr; extraword_present = get_bits1(&gb); nonrestart_substr = get_bits1(&gb); checkdata_present = get_bits1(&gb); skip_bits1(&gb); end = get_bits(&gb, 12) * 2; substr_header_size += 2; if (extraword_present) { if (m->avctx->codec_id == AV_CODEC_ID_MLP) { av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n"); skip_bits(&gb, 16); substr_header_size += 2; if (!(nonrestart_substr ^ m->is_major_sync_unit)) { av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n"); if (end + header_size + substr_header_size > length) { av_log(m->avctx, AV_LOG_ERROR, "Indicated length of substream %d data goes off end of " "packet.\n", substr); end = length - header_size - substr_header_size; if (end < substream_start) { av_log(avctx, AV_LOG_ERROR, "Indicated end offset of substream %d data " "is smaller than calculated start offset.\n", substr); if (substr > m->max_decoded_substream) continue; substream_parity_present[substr] = checkdata_present; substream_data_len[substr] = end - substream_start; substream_start = end; parity_bits = ff_mlp_calculate_parity(buf, 4); parity_bits ^= ff_mlp_calculate_parity(buf + header_size, substr_header_size); if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(avctx, AV_LOG_ERROR, "Parity check failed.\n"); buf += header_size + substr_header_size; for (substr = 0; substr <= m->max_decoded_substream; substr++) { SubStream *s = &m->substream[substr]; init_get_bits(&gb, buf, substream_data_len[substr] * 8); m->matrix_changed = 0; memset(m->filter_changed, 0, sizeof(m->filter_changed)); s->blockpos = 0; do { if (get_bits1(&gb)) { if (get_bits1(&gb)) { if (read_restart_header(m, &gb, buf, substr) < 0) goto next_substr; s->restart_seen = 1; if (!s->restart_seen) goto next_substr; if (read_decoding_params(m, &gb, substr) < 0) goto next_substr; if (!s->restart_seen) goto next_substr; if ((ret = read_block_data(m, &gb, substr)) < 0) return ret; if (get_bits_count(&gb) >= substream_data_len[substr] * 8) goto substream_length_mismatch; } while (!get_bits1(&gb)); skip_bits(&gb, (-get_bits_count(&gb)) & 15); if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) { int shorten_by; if (get_bits(&gb, 16) != 0xD234) return AVERROR_INVALIDDATA; shorten_by = get_bits(&gb, 16); if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD && shorten_by & 0x2000) s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos); else if (m->avctx->codec_id == AV_CODEC_ID_MLP && shorten_by != 0xD234) return AVERROR_INVALIDDATA; if (substr == m->max_decoded_substream) av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n"); if (substream_parity_present[substr]) { uint8_t parity, checksum; if (substream_data_len[substr] * 8 - get_bits_count(&gb) != 16) goto substream_length_mismatch; parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2); checksum = ff_mlp_checksum8 (buf, substream_data_len[substr] - 2); if ((get_bits(&gb, 8) ^ parity) != 0xa9 ) av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr); if ( get_bits(&gb, 8) != checksum) av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr); if (substream_data_len[substr] * 8 != get_bits_count(&gb)) goto substream_length_mismatch; next_substr: if (!s->restart_seen) av_log(m->avctx, AV_LOG_ERROR, "No restart header present in substream %d.\n", substr); buf += substream_data_len[substr]; if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0) return ret; return length; substream_length_mismatch: av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr); return AVERROR_INVALIDDATA; error: m->params_valid = 0; return AVERROR_INVALIDDATA;
1threat
simulate for onClick not working in enzyme : <p>This is a cancel button</p> <pre><code>&lt;div className="cancelFileBtn" onClick={this.props.cancelFileSending}&gt; </code></pre> <p>I need to simulate its click,I tried the following test </p> <pre><code>wrapper.find('.cancelFileBtn').simulate('click'); </code></pre> <p>But the click function is still undefined...Did I miss anything else? and it will be very helpful if anyone can mention any changes if exist in simulating</p> <pre><code>&lt;SendMessageButton onClick={this.props.handleClickSendMessage} loadingFile={this.props.loadingFile}/&gt; </code></pre>
0debug
How do I search for a pip package by name only? : <p>By default pip searches both package names and descriptions. For some packages this results in a huge number of spurious hits and finding the one I actually want is a pain.</p> <p>How I tell pip I want to search by name only?</p>
0debug
static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, unsigned size) { unsigned i, j; CodeBook cb = { 0 }; if (!can_safely_read(gb, (uint64_t)size * 34)) return cb; if (size >= INT_MAX / sizeof(MacroBlock)) return cb; cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1); if (!cb.blocks) return cb; cb.depth = depth; cb.size = size; for (i = 0; i < size; i++) { unsigned mask_bits = get_bits(gb, 4); unsigned color0 = get_bits(gb, 15); unsigned color1 = get_bits(gb, 15); for (j = 0; j < 4; j++) { if (mask_bits & (1 << j)) cb.blocks[i].pixels[j] = color1; else cb.blocks[i].pixels[j] = color0; } } return cb; }
1threat
In Dart, what's the difference between List.from and .of, and between Map.from and .of? : <p>In Dart, what's the difference between <code>List.from</code> and <code>List.of</code>, and between <code>Map.from</code> and <code>Map.of</code>? Their documentation is not totally clear:</p> <pre><code>/** * Creates a [LinkedHashMap] instance that contains all key/value pairs of * [other]. * * The keys must all be instances of [K] and the values of [V]. * The [other] map itself can have any type. * * A `LinkedHashMap` requires the keys to implement compatible * `operator==` and `hashCode`, and it allows `null` as a key. * It iterates in key insertion order. */ factory Map.from(Map other) = LinkedHashMap&lt;K, V&gt;.from; /** * Creates a [LinkedHashMap] with the same keys and values as [other]. * * A `LinkedHashMap` requires the keys to implement compatible * `operator==` and `hashCode`, and it allows `null` as a key. * It iterates in key insertion order. */ factory Map.of(Map&lt;K, V&gt; other) = LinkedHashMap&lt;K, V&gt;.of; /** * Creates a list containing all [elements]. * * The [Iterator] of [elements] provides the order of the elements. * * All the [elements] should be instances of [E]. * The `elements` iterable itself may have any element type, so this * constructor can be used to down-cast a `List`, for example as: * ```dart * List&lt;SuperType&gt; superList = ...; * List&lt;SubType&gt; subList = * new List&lt;SubType&gt;.from(superList.whereType&lt;SubType&gt;()); * ``` * * This constructor creates a growable list when [growable] is true; * otherwise, it returns a fixed-length list. */ external factory List.from(Iterable elements, {bool growable: true}); /** * Creates a list from [elements]. * * The [Iterator] of [elements] provides the order of the elements. * * This constructor creates a growable list when [growable] is true; * otherwise, it returns a fixed-length list. */ factory List.of(Iterable&lt;E&gt; elements, {bool growable: true}) =&gt; new List&lt;E&gt;.from(elements, growable: growable); </code></pre> <p>Is the difference related to generics? Maybe the <code>.from</code> factories let you change the type of the list, while the <code>.of</code> ones do not? I come from a Java background, which works with type erasure, and maybe types are reified in Dart and you cannot use casts or raw types to change list/map types?</p>
0debug
void cpu_dump_state (CPUCRISState *env, FILE *f, fprintf_function cpu_fprintf, int flags) { int i; uint32_t srs; if (!env || !f) return; cpu_fprintf(f, "PC=%x CCS=%x btaken=%d btarget=%x\n" "cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n", env->pc, env->pregs[PR_CCS], env->btaken, env->btarget, env->cc_op, env->cc_src, env->cc_dest, env->cc_result, env->cc_mask); for (i = 0; i < 16; i++) { cpu_fprintf(f, "%s=%8.8x ",regnames[i], env->regs[i]); if ((i + 1) % 4 == 0) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "\nspecial regs:\n"); for (i = 0; i < 16; i++) { cpu_fprintf(f, "%s=%8.8x ", pregnames[i], env->pregs[i]); if ((i + 1) % 4 == 0) cpu_fprintf(f, "\n"); } srs = env->pregs[PR_SRS]; cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs); if (srs < 256) { for (i = 0; i < 16; i++) { cpu_fprintf(f, "s%2.2d=%8.8x ", i, env->sregs[srs][i]); if ((i + 1) % 4 == 0) cpu_fprintf(f, "\n"); } } cpu_fprintf(f, "\n\n"); }
1threat
How to acces ouside variable value in abstract call in PHP : i am new in PHP. I tired to access outside variable values in Abstract class. The code written blow. Help to fix it. I think i am doing something wrong But i don't know. <?php $a = "value1"; $b = "value2"; abstract class connect { public function __construct() { $sum = $a + $b; return $sum; } } ?>
0debug
static int jpeg_write_trailer(AVFormatContext *s1) { JpegContext *s = s1->priv_data; av_free(s); return 0; }
1threat
What is the need of backup in aws RDS? : I have a doubt if in aws all server side work is done by cloud manager then why do we store backup for database? I have studied in documentation that all the things are managed by cloud service providers for the database related things. Then what is the need of storing backup if service provider do everything for me
0debug
static void do_change_block(const char *device, const char *filename, const char *fmt) { BlockDriverState *bs; BlockDriver *drv = NULL; bs = bdrv_find(device); if (!bs) { term_printf("device not found\n"); return; } if (fmt) { drv = bdrv_find_format(fmt); if (!drv) { term_printf("invalid format %s\n", fmt); return; } } if (eject_device(bs, 0) < 0) return; bdrv_open2(bs, filename, 0, drv); qemu_key_check(bs, filename); }
1threat
How to avoid callback hell after one AJAX call : <p>I have a nodeJS application that requests data from an API once. I then want to do some processing on this data by using separate functions. However, since the AJAX is asynchronous, I'm forced to use async as follows: </p> <pre><code>async.series( [ function(callback) { getContentFromAPI("banana",callback); }, function(callback) { doSomeProcess1(callback); }, function(callback) { doSomeProcess2(callback); }, function(callback) { doSomeProcess3(callback); }, function(callback) { doSomeProcess4(callback); }, ] ); </code></pre> <p>Is there any way this can be done better? I'm only requesting one asynchronous process and want to avoid using async since all the other processes are sync.</p> <p>What should I do?</p>
0debug
How to check JSP varilable and hide if value is null/empty or some specific string? : I am creating a project where i am getting set data in JSP page from database. if any field data value is null the jsp page is showing null but i do not want to show it on jsp page. please help. i am getting data from bean. @page import="com.mvc.bean.ProjectBean"% %=p.getOffer()%
0debug
How to set a custom environment variable in EMR to be available for a spark Application : <p>I need to set a custom environment variable in EMR to be available when running a spark application. </p> <p>I have tried adding this: </p> <pre><code> ... --configurations '[ { "Classification": "spark-env", "Configurations": [ { "Classification": "export", "Configurations": [], "Properties": { "SOME-ENV-VAR": "qa1" } } ], "Properties": {} } ]' ... </code></pre> <p>and also tried to replace "spark-env with <code>hadoop-env</code> but nothing seems to work.</p> <p>There is <a href="https://forums.aws.amazon.com/thread.jspa?threadID=223617" rel="noreferrer">this</a> answer from the aws forums. but I can't figure out how to apply it. I'm running on EMR 5.3.1 and launch it with a preconfigured step from the cli: <code>aws emr create-cluster...</code></p>
0debug
static int decode_p_mbs(VC9Context *v) { int x, y, current_mb = 0, i; int skip_mb_bit = 0, cbpcy; int hybrid_pred, ac_pred; int mb_has_coeffs = 1 , mb_is_intra; int dmv_x, dmv_y; int mv_mode_bit = 0; int mqdiff, mquant; int tt_block; static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, offset_table[6] = { 0, 1, 3, 7, 15, 31 }; int k_x, k_y; int hpel_flag, intra_flag; int index, index1; int val, sign; if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0]; else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1]; else v->ttmb_vlc = &vc9_ttmb_vlc[2]; switch (v->mvrange) { case 1: k_x = 10; k_y = 9; break; case 2: k_x = 12; k_y = 10; break; case 3: k_x = 13; k_y = 11; break; default: k_x = 9; k_y = 8; break; } hpel_flag = v->mv_mode & 1; k_x -= hpel_flag; k_y -= hpel_flag; for (y=0; y<v->height_mb; y++) { for (x=0; x<v->width_mb; x++) { if (v->mv_type_mb_plane[current_mb]) mv_mode_bit = get_bits(&v->gb, 1); if (0) skip_mb_bit = get_bits(&v->gb, 1); if (!mv_mode_bit) { if (!v->skip_mb_plane[current_mb]) { GET_MVDATA(); if (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV) hybrid_pred = get_bits(&v->gb, 1); if (mb_is_intra && !mb_has_coeffs) { GET_MQUANT(); ac_pred = get_bits(&v->gb, 1); } else if (mb_has_coeffs) { if (mb_is_intra) ac_pred = get_bits(&v->gb, 1); cbpcy = get_vlc2(&v->gb, v->cbpcy_vlc->table, VC9_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } if (!v->ttmbf) v->ttfrm = get_vlc2(&v->gb, v->ttmb_vlc->table, VC9_TTMB_VLC_BITS, 2); } else { if (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV) hybrid_pred = get_bits(&v->gb, 1); } } else { if (!v->skip_mb_plane[current_mb] ) { cbpcy = get_vlc2(&v->gb, v->cbpcy_vlc->table, VC9_CBPCY_P_VLC_BITS, 2); for (i=0; i<4; i++) { if (cbpcy & (1<<6) ) { GET_MVDATA(); } if (v->mv_mode == MV_PMODE_MIXED_MV ) hybrid_pred = get_bits(&v->gb, 1); GET_MQUANT(); if (mb_is_intra && index ) ac_pred = get_bits(&v->gb, 1); if (!v->ttmbf) tt_block = get_vlc2(&v->gb, v->ttmb_vlc->table, VC9_TTMB_VLC_BITS, 2); cbpcy <<= 1; } } else MB { for (i=0; i<4; i++) { if (v->mv_mode == MV_PMODE_MIXED_MV ) hybrid_pred = get_bits(&v->gb, 1); } } } } current_mb++; } return 0; }
1threat
in laravel is there any way to store foreach value in database : > i am trying to store view foreach value in database using controller Is there any other way to store value by controller without view foreach > this is my view page @foreach ($ticket_details as $key=>$ticket_detailss) <li> <h3 style="text-align:center ">TICKET ID<small class="text-success "><br type="text" id="ticket_id" name="ticket_id" >{{$ticket_detailss->ticket_id }}</small></h3> </li> <li> <h3 style="text-align:center ">SUBJECT<small class="text-success "><br>{{$ticket_detailss->subject }}</small></h3> </li> <li> <h3 style="text-align:center ">NAME<small class="text-success "><br type="text" id="names" name="names" >{{$ticket_detailss->name }}</small></h3> </li> <li> <h3 style="text-align:center ">ID<small class="text-success "><br type="text" id="user_filter_id" name="user_filter_id" >{{$ticket_detailss->user_filter_id }}</small></h3> </li> <li> <h3 style="text-align:center ">STAFF ID<small class="text-success "><br type="text" id="user_staff_id" name="user_staff_id" >{{$ticket_detailss->user_staff_id }}</small></h3> </li> @endforeach > This is my controller public function manager_send_messageChat(Request $request) { }
0debug
What is the difference between a String[] and String in a for loop (Java) : <p>Before you ask, yes I did Google this first. I haven't found a proper answer yet. I understand the syntax for a String array in a for loop, but not for a String. For example, let's say I have a fragment code which includes a for loop that's purpose is to adjust an element of the String to "josh" if that element isn't equal to <em>something</em> (I can't think of anything at the top of my head). The fragment code would be like this:</p> <pre><code>public void adjustScore(String[] str){ for(int j= 0; j &lt; str.length; j++){ if(str[j] != //idk, something// str[j]= "josh"; } else{}; } </code></pre> <p>But, how would this look if it was a String instead of a String[]? </p> <pre><code>public void adjustScore(String str2){ for(int j=0; j &lt; str2.length(); j++){ // How do I call an element from the String? Would I still use str2[j]?// </code></pre>
0debug
static bool scsi_target_emulate_report_luns(SCSITargetReq *r) { BusChild *kid; int i, len, n; int channel, id; bool found_lun0; if (r->req.cmd.xfer < 16) { return false; } if (r->req.cmd.buf[2] > 2) { return false; } channel = r->req.dev->channel; id = r->req.dev->id; found_lun0 = false; n = 0; QTAILQ_FOREACH(kid, &r->req.bus->qbus.children, sibling) { DeviceState *qdev = kid->child; SCSIDevice *dev = SCSI_DEVICE(qdev); if (dev->channel == channel && dev->id == id) { if (dev->lun == 0) { found_lun0 = true; } n += 8; } } if (!found_lun0) { n += 8; } len = MIN(n + 8, r->req.cmd.xfer & ~7); if (len > sizeof(r->buf)) { return false; } memset(r->buf, 0, len); stl_be_p(&r->buf, n); i = found_lun0 ? 8 : 16; QTAILQ_FOREACH(kid, &r->req.bus->qbus.children, sibling) { DeviceState *qdev = kid->child; SCSIDevice *dev = SCSI_DEVICE(qdev); if (dev->channel == channel && dev->id == id) { store_lun(&r->buf[i], dev->lun); i += 8; } } assert(i == n + 8); r->len = len; return true; }
1threat
Prevent Visual Studio from trying to parse typescript : <p>Working on a project using Visual Studio as my IDE. It has an API component written in C#, and a webserver component that uses TypeScript. </p> <p>I am using webpack to deal with the typescript compilation and would like to remove the Visual Studio build step from the typescript files. </p> <p>Normally I wouldn't care if it was building them, but I am using Typescript > 1.8.4 which has language features that Visual Studio cannot understand which is making Visual Studio throw errors and prevent compilation. I found a workaround for this in <a href="https://github.com/Microsoft/TypeScript/issues/8518" rel="noreferrer">this github issue thread</a> but I have other developers cross team who are working on this and trying to coordinate a hack to make code among them will not work. </p> <p>I have also tried removing the typescript imports line from the .csproj file, but whenever I add a new ts file, it adds the line back in. </p> <p>Is there a way to completely shut down the typescript compilation/parsing step in Visual Studio and prevent it from coming back?</p> <p>This in in VS 2015.</p>
0debug
How to round decimal to 2 places? : <p>Below, I am using this JS:</p> <pre><code> $("input[name='AuthorizedAmount'], input[name='LessLaborToDate']").change(function () { var sum = parseFloat($("input[name='AuthorizedAmount']").val()).toFixed(2) - parseFloat($("input[name='LessLaborToDate']").val()).toFixed(2); $("input[name='Subtotal'").val(sum).toFixed(2); }); </code></pre> <p>When I subtract AuthorizedAmount from LessLaborToDate, the number occurring for me in the Subtotal box has a lot of floating numbers past the decimal point. Below is the HTML for the boxes:</p> <pre><code> &lt;div class="box-body"&gt; &lt;div class="row"&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;label&gt;Authorized Amount&lt;/label&gt; &lt;div class="input-group"&gt; &lt;span class="input-group-addon"&gt;$&lt;/span&gt; &lt;input type="number" class="form-control" name="AuthorizedAmount" min="0" max="9999999999.99" step="0.01" required&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /.form-group --&gt; &lt;/div&gt;&lt;!-- /.col --&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;label&gt;Less Labor to Date&lt;/label&gt; &lt;div class="input-group"&gt; &lt;span class="input-group-addon"&gt;$&lt;/span&gt; &lt;input type="number" value="0" class="form-control" name="LessLaborToDate" min="0" max="9999999999.99" step="0.01" required&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /.form-group --&gt; &lt;/div&gt;&lt;!-- /.col --&gt; &lt;/div&gt;&lt;!-- /.row --&gt; &lt;div class="row"&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;label&gt;Subtotal&lt;/label&gt; &lt;div class="input-group"&gt; &lt;span class="input-group-addon"&gt;$&lt;/span&gt; &lt;input type="number" class="form-control" name="Subtotal" placeholder="Authorized Amount minus Less Labor to Date" min="0" max="9999999999.99" step="0.01" readonly&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /.form-group --&gt; &lt;/div&gt;&lt;!-- /.col --&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /.col --&gt; &lt;/div&gt;&lt;!-- /.row --&gt; &lt;/div&gt;&lt;!-- /.box-body --&gt; </code></pre> <p>Am I doing something wrong for it to not show only 2 decimal places?</p>
0debug
void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y, int negative) { x++; y++; t1->flags[y][x] |= JPEG2000_T1_SIG; if (negative) { t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W | JPEG2000_T1_SGN_W; t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E | JPEG2000_T1_SGN_E; t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N | JPEG2000_T1_SGN_N; t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S | JPEG2000_T1_SGN_S; } else { t1->flags[y][x + 1] |= JPEG2000_T1_SIG_W; t1->flags[y][x - 1] |= JPEG2000_T1_SIG_E; t1->flags[y + 1][x] |= JPEG2000_T1_SIG_N; t1->flags[y - 1][x] |= JPEG2000_T1_SIG_S; } t1->flags[y + 1][x + 1] |= JPEG2000_T1_SIG_NW; t1->flags[y + 1][x - 1] |= JPEG2000_T1_SIG_NE; t1->flags[y - 1][x + 1] |= JPEG2000_T1_SIG_SW; t1->flags[y - 1][x - 1] |= JPEG2000_T1_SIG_SE; }
1threat
Why am i not allowed to use this string inside the if-bracket? : <p>This maybe a silly question with a simple solution, but i cant figure out why it doesn't let me use the string "datatxt" inside the if-bracket. It says, "The name 'datatxt' does not exist in the current context". Any help is apprechiated.</p> <pre><code> try { StreamReader sr = new StreamReader("Data.txt"); String datatxt = sr.ReadLine(); } catch (Exception ex) { Console.WriteLine("An error har occured: '{0}'", ex); } if (UserBox.Text.Equals(user) &amp;&amp; PassBox.Text.Equals(data + datatxt)) { Main s = new Main(); s.Show(); this.Hide(); </code></pre>
0debug
what is difference between inverse property and foreign key in entity framework? : <p>I knew that Inverse Property is used when you have multiple relationships between classes. but I am confused between inverse property and foreign key property since both of them are used for defining relationships.</p> <pre><code>public class PrivilegeToDbOperationTypeMap : BaseEntity { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity), Column(Order = 0)] public int PrivilegeToDbOperationTypeMapId { get; set; } [ForeignKey("privilegeLookup"), Column(Order = 1)] [Index("IX_PrivilegeLookupId_DbOperationLookupId", 1, IsUnique = true)] public int PrivilegeLookupId { get; set; } [ForeignKey("dbOperationTypeLookup"), Column(Order = 2)] [Index("IX_PrivilegeLookupId_DbOperationLookupId", 2, IsUnique = true)] public int DbOperationLookupId { get; set; } #region Navigation Properties public PrivilegeLookup privilegeLookup { get; set; } public DbOperationTypeLookup dbOperationTypeLookup { get; set; } [InverseProperty("privilegeToDbOperationTypeMap")] public ICollection&lt;RoleToPrivilegeDbOperationTypeMap&gt; roleToPrivilegeDbOperationTypeMaps { get; set; } #endregion Navigation Properties } </code></pre>
0debug
Readmore.js won't work : I try to use Readmore.js for the first time and can't really understand the reason why nothing changes. I checked twice if the source files are there for both jQuery and readmore. <html lang="en"> <head> <meta charset="utf-8"> <title>Gifts</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="index.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet"> <script src="/node_modules/readmore-js/readmore.min.js"></script> <script src="jquery-3.3.1.min.js"></script> </head> <body> <article> <p class="giftheading"><b>Name Surname</b> celebrates <b>Event</b> in <b>5</b> days!</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam mattis consectetur nunc facilisis imperdiet. Donec sed arcu augue. Vestibulum tristique lobortis nulla eget pellentesque. Quisque consectetur vitae dui a porttitor. Suspendisse vel imperdiet dui, semper maximus sem. Aliquam in quam ornare, fringilla tellus sit amet, sodales ligula.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam mattis consectetur nunc facilisis imperdiet. Donec sed arcu augue. Vestibulum tristique lobortis nulla eget pellentesque. Quisque consectetur vitae dui a porttitor. Suspendisse vel imperdiet dui, semper maximus sem. Aliquam in quam ornare, fringilla tellus sit amet, sodales ligula.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam mattis consectetur nunc facilisis imperdiet. Donec sed arcu augue. Vestibulum tristique lobortis nulla eget pellentesque. Quisque consectetur vitae dui a porttitor. Suspendisse vel imperdiet dui, semper maximus sem. Aliquam in quam ornare, fringilla tellus sit amet, sodales ligula.</p> </article> <script> $('article').readmore(); </script> </body> </html>
0debug
Modifying email that has already been sent : Let me set up the situation. There is a webform form that was written in ASP.Net using VB. The form has text fields that ask for common information (Name, current date, position, etc.). None of this information is sensative info. There is also a drop-down list that contains email address for certain department. Anyway, once the form is completed, and an department email has been choosen to from the drop down list, this information is emailed to 5 seperate email. The email choosen from the drop down list will be added to the email as a carbon copied (CC:) receipient. When the the user clicks the Submit but, it generates an email that will display the information from the form, as well as two links, one Approval link an one Deny link, where each link will go to two different urls repectively. Again, this email is sent out to the 5 main receipient and one carbon copyied email receipient choosen from the user in the drop down list on the form. Here are my questions: 1. Programmatically, is there a way to have the two url links in the email diabled, maybe even hidden, from the carbon copied email receipient only when the email is sent out? Only the 5 main email receipient will see and click on either url links. 2. If not possible programmatically, is there a way to do have this done by manipulating Active Directory or Exchange Server? 3. By doing this, is this violating any software compliance agreements. Please note, that is only a hypothetical situation. The webform and it's setup has been created, and can send email via SMTP, but not in the way as mentioned in the hypothetical questions I just asked. I am just checking if what I asked is even possible and how can I approach it. I've done some research, but haven't found anything saying that this is possible. Whatever opinion you can give me will be very appreciated.
0debug
void do_info_vnc(Monitor *mon) { if (vnc_display == NULL || vnc_display->display == NULL) monitor_printf(mon, "VNC server disabled\n"); else { monitor_printf(mon, "VNC server active on: "); monitor_print_filename(mon, vnc_display->display); monitor_printf(mon, "\n"); if (vnc_display->clients == NULL) monitor_printf(mon, "No client connected\n"); else monitor_printf(mon, "Client connected\n"); } }
1threat
void kvmppc_hash64_write_pte(CPUPPCState *env, target_ulong pte_index, target_ulong pte0, target_ulong pte1) { int htab_fd; struct kvm_get_htab_fd ghf; struct kvm_get_htab_buf hpte_buf; ghf.flags = 0; ghf.start_index = 0; htab_fd = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf); if (htab_fd < 0) { goto error_out; } hpte_buf.header.n_valid = 1; hpte_buf.header.n_invalid = 0; hpte_buf.header.index = pte_index; hpte_buf.hpte[0] = pte0; hpte_buf.hpte[1] = pte1; if (write(htab_fd, &hpte_buf, sizeof(hpte_buf)) < 0) { goto out_close; } out_close: close(htab_fd); return; error_out: return; }
1threat
Issues with heat map in matplotlib : <p>I am trying to draw a heat map in matplotlib in two ways:</p> <pre><code>plt.figure(figsize=(8, 6)) heatmap, xedges, yedges = np.histogram2d(rtl, zs, bins=(128, 128)) extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]] plt.clf() plt.xscale('log') plt.imshow(heatmap, extent=extent) plt.show() </code></pre> <p>The second way is:</p> <pre><code>fig, ax = plt.subplots(figsize=(8, 6)) hb = ax.hexbin(rtl, zs, gridsize=50) ax.axis([min(rtl), max(rtl), min(zs), max(zs)]) plt.show() </code></pre> <p>But for the same data, I am getting really different plots. I am not understanding what is going on here.</p> <p><a href="https://imagebin.ca/v/3YHcqeoi87O9" rel="nofollow noreferrer">plot1</a> <a href="https://imagebin.ca/v/3YHdD8YftGir" rel="nofollow noreferrer">plot2</a></p>
0debug
static void spr_write_hdecr(DisasContext *ctx, int sprn, int gprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_store_hdecr(cpu_env, cpu_gpr[gprn]); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
1threat
How to create cookies in website rather then browser? : <p>I want to store the cookies in website rather then browser to access the same content on cross browser. Please conclude your suggestion.</p>
0debug
typescript - can tsc be run against an entire folder? : <p>I'm pretty surprised this isn't in the docs that I could find - but is there any way to just tell <code>tsc</code> to run against all files in a directory and its children without going through a whole <code>tsconfig.json</code> setup?</p>
0debug
How to Reduce with paste function with different seperator : <p>For the following operation:</p> <pre><code>avector&lt;-c("p1","p2","p3") Reduce(paste,avector) ## "p1 p2 p3" </code></pre> <p>I want to get <code>"p1.p2.p3"</code> Which is applying the paste function in <code>Reduce</code> with separator <code>"."</code> Please advice.</p>
0debug
I want to know if single line calculator can be done using java : <p>Is single line calculator possible? For example, if I input <strong>1 + 2 + 10 - 5 * 3</strong>, it will calculate it and display the result.</p>
0debug
static void serial_receive1(void *opaque, const uint8_t *buf, int size) { SerialState *s = opaque; serial_receive_byte(s, buf[0]); }
1threat
What is difference between 'data:' and 'data()' in Vue.js? : <p>I have used data option in two ways. In first snippet data object contains a key value, however, in second data is a function. Is there any benefits of individuals.Not able to find relevant explanations on Vue.js Docs Here are two code snippets:</p> <pre><code>new Vue({ el: "#app", data: { message: 'hello mr. magoo' } }); new Vue({ el: "#app", data() { return { message: 'hello mr. magoo' } } }); </code></pre> <p>Both are giving me the same output.</p>
0debug
Why does autograd not produce gradient for intermediate variables? : <p>trying to wrap my head around how gradients are represented and how autograd works:</p> <pre><code>import torch from torch.autograd import Variable x = Variable(torch.Tensor([2]), requires_grad=True) y = x * x z = y * y z.backward() print(x.grad) #Variable containing: #32 #[torch.FloatTensor of size 1] print(y.grad) #None </code></pre> <p>Why does it not produce a gradient for <code>y</code>? If <code>y.grad = dz/dy</code>, then shouldn't it at least produce a variable like <code>y.grad = 2*y</code>?</p>
0debug
php multi dementsional array hierarchy : hello everyone please i want toknow how can i get the hierarchy by the identifier. this is an example : $inputArray = array( array( "text" => "Dir1", "parent_id" => "", "id" => "1", "filesize" => "109" ),array( "text" => "dir2", "parent_id" => "", "id" => "2", "filesize" => "88", "children" => array( "text" => "Dir3", "parent_id" => "2", "id" => "3", "filesize" => "", "children" => array( "text" => "dir4", "parent_id" => "3", "id" => "4", "filesize" => "", "children" => array( "text" => "dir5", "parent_id" => "4", "id" => "4", "filesize" => "" ) ) ) )); looking for this example : dir3/dir4/dir5
0debug
static int trap_msix(S390PCIBusDevice *pbdev, uint64_t offset, uint8_t pcias) { if (pbdev->msix.available && pbdev->msix.table_bar == pcias && offset >= pbdev->msix.table_offset && offset <= pbdev->msix.table_offset + (pbdev->msix.entries - 1) * PCI_MSIX_ENTRY_SIZE) { return 1; } else { return 0; } }
1threat
make jquery array with each(function) for selects and inputs : I want to rebuild this array: var testarr=[["Option1","","Text1"],["Option2","Input_1",""]]; with jquery each(function) an push() for selects and inputs <div> <select id="idTest" class="select_css" name="selectTest[]"> <option value="" selected>Option</option> <option value="Option1">Option1</option> <option value="Option2">Option2</option> </select> <input type="text" class="input_css" data-room="1" name="input_1[]" /> <input type="text" class="input_css" data-other="1" name="input_2[]" /> </div> <div> <textarea name="textareaTest[]" placeholder="Test" class="textarea_css" id="textarea1"></textarea> </div> <div> <select id="idTest" class="select_css" name="selectTest[]"> <option value="" selected>Option</option> <option value="Option1">Option1</option> <option value="Option2">Option2</option> </select> <input type="text" class="input_css" name="input_1[]" /> <input type="text" class="input_css" name="input_2[]" /> </div> <div> <textarea name="textareaTest[]" placeholder="Test" class="textarea_css" id="textarea1"></textarea> </div> <div id="arrlist"></div> <script> var testarr=[["Option1","","Text1"],["Option2","Input_1",""]]; for(var i=0; i<testarr.length; i++) { text = '<div>'+testarr[i][0]+'<br>'+testarr[i][1]+'</div><div>'+testarr[i][2]+'</div>'; $("#arrlist").append(text); } </script> [https://jsfiddle.net/htpmj532/6/][1] [1]: https://jsfiddle.net/htpmj532/6/
0debug
Import personnalized newsletter to mailchimp : So I've coded a mailchimp newsletter with their code format. But the problem is that when I import that newsletter, it don't gets on "drag and drop" mode but goes on "code your own" mode so we only can modify it with code. I won't touch to that newsletter after, so I would like to modify it with drag and drop for the next ones who'll use it. Thank's in advance guys.
0debug
static void get_default_channel_layouts(OutputStream *ost, InputStream *ist) { char layout_name[256]; AVCodecContext *enc = ost->st->codec; AVCodecContext *dec = ist->st->codec; if (dec->channel_layout && av_get_channel_layout_nb_channels(dec->channel_layout) != dec->channels) { av_get_channel_layout_string(layout_name, sizeof(layout_name), dec->channels, dec->channel_layout); av_log(NULL, AV_LOG_ERROR, "New channel layout (%s) is invalid\n", layout_name); dec->channel_layout = 0; } if (!dec->channel_layout) { if (enc->channel_layout && dec->channels == enc->channels) { dec->channel_layout = enc->channel_layout; } else { dec->channel_layout = av_get_default_channel_layout(dec->channels); if (!dec->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel " "layout for Input Stream #%d.%d\n", ist->file_index, ist->st->index); exit_program(1); } } av_get_channel_layout_string(layout_name, sizeof(layout_name), dec->channels, dec->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); } if (!enc->channel_layout) { if (dec->channels == enc->channels) { enc->channel_layout = dec->channel_layout; return; } else { enc->channel_layout = av_get_default_channel_layout(enc->channels); } if (!enc->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel layout " "for Output Stream #%d.%d\n", ost->file_index, ost->st->index); exit_program(1); } av_get_channel_layout_string(layout_name, sizeof(layout_name), enc->channels, enc->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Output Stream " "#%d.%d : %s\n", ost->file_index, ost->st->index, layout_name); } }
1threat
I would like to create a 2-level navigation but i am stuck : I would like to create a 2-level navigation with delay effect when hovering over the cursor but I'm stuck!
0debug
Conda takes 20+ minutes to solve environment when package is already installed : <p>NOTE: I'm duplicating this post because the question has been up on the conda github page for ~6-days with no response. The original link is here: <a href="https://github.com/conda/conda/issues/7938" rel="noreferrer">https://github.com/conda/conda/issues/7938</a></p> <h2>Current Behavior</h2> <p>When I type try to run <code>conda update -n base conda</code>, conda hung for around 20-minutes on 'Solving environment' and then returned a package plan that did not include an updated version of conda. The package plan that was returned is provided below. </p> <p><strong>The package plan that was returned is as follows:</strong></p> <pre><code>environment location: C:\Users\jmatt\Anaconda3 added / updated specs: - conda The following packages will be downloaded: package | build ---------------------------|----------------- libarchive-3.3.2 | h1d0d21d_1 4.0 MB lz4-c-1.8.2 | vc14_0 254 KB conda-forge libcurl-7.61.1 | h7602738_0 249 KB ------------------------------------------------------------ Total: 4.5 MB The following packages will be UPDATED: jpeg: 9b-hb83a4c4_2 --&gt; 9b-vc14_2 conda-forge [vc14] libcurl: 7.61.1-h2a8f88b_0 --&gt; 7.61.1-h7602738_0 libsodium: 1.0.16-h9d3ae62_0 --&gt; 1.0.16-vc14_0 conda-forge [vc14] libxslt: 1.1.32-hf6f1972_0 --&gt; 1.1.32-vc14_0 conda-forge [vc14] lz4-c: 1.8.1.2-h2fa13f4_0 --&gt; 1.8.2-vc14_0 conda-forge [vc14] tk: 8.6.8-hfa6e2cd_0 --&gt; 8.6.8-vc14_0 conda-forge [vc14] zeromq: 4.2.5-he025d50_1 --&gt; 4.2.5-vc14_2 conda-forge [vc14] The following packages will be DOWNGRADED: astropy: 3.0.5-py36he774522_0 --&gt; 3.0.4-py36hfa6e2cd_0 bzip2: 1.0.6-hfa6e2cd_5 --&gt; 1.0.6-vc14_1 conda-forge [vc14] curl: 7.61.1-h2a8f88b_0 --&gt; 7.60.0-vc14_0 conda-forge [vc14] cython: 0.29-py36ha925a31_0 --&gt; 0.28.5-py36h6538335_0 freetype: 2.9.1-ha9979f8_1 --&gt; 2.8.1-vc14_0 conda-forge [vc14] gevent: 1.3.7-py36he774522_1 --&gt; 1.3.6-py36hfa6e2cd_0 hdf5: 1.10.2-hac2f561_1 --&gt; 1.10.2-vc14_0 conda-forge [vc14] icu: 58.2-ha66f8fd_1 --&gt; 58.2-vc14_0 conda-forge [vc14] krb5: 1.16.1-h038dc86_6 --&gt; 1.14.6-vc14_0 conda-forge [vc14] libarchive: 3.3.3-h798a506_0 --&gt; 3.3.2-h1d0d21d_1 libiconv: 1.15-h1df5818_7 --&gt; 1.14-vc14_4 conda-forge [vc14] libpng: 1.6.35-h2a8f88b_0 --&gt; 1.6.34-vc14_0 conda-forge [vc14] libtiff: 4.0.9-h36446d0_2 --&gt; 4.0.9-vc14_0 conda-forge [vc14] libxml2: 2.9.8-hadb2253_1 --&gt; 2.9.5-vc14_1 conda-forge [vc14] llvmlite: 0.25.0-py36_0 --&gt; 0.24.0-py36h6538335_0 lxml: 4.2.5-py36hef2cd61_0 --&gt; 4.1.1-py36he0adb16_0 lzo: 2.10-h6df0209_2 --&gt; 2.10-vc14_0 conda-forge [vc14] matplotlib: 3.0.0-py36hd159220_0 --&gt; 2.2.2-py36h153e9ff_0 mistune: 0.8.4-py36he774522_0 --&gt; 0.8.3-py36hfa6e2cd_1 numba: 0.40.0-py36hf9181ef_0 --&gt; 0.39.0-py36h830ac7b_0 pillow: 5.3.0-py36hdc69c19_0 --&gt; 5.1.0-py36h0738816_0 pyqt: 5.9.2-py36h6538335_2 --&gt; 5.6.0-py36_2 pywavelets: 1.0.1-py36h8c2d366_0 --&gt; 1.0.0-py36h452e1ab_0 qt: 5.9.6-vc14h1e9a669_2 --&gt; 5.6.2-vc14_1 conda-forge [vc14] snappy: 1.1.7-h777316e_3 --&gt; 1.1.7-vc14_1 conda-forge [vc14] sqlalchemy: 1.2.12-py36he774522_0 --&gt; 1.2.11-py36hfa6e2cd_0 sqlite: 3.25.2-hfa6e2cd_0 --&gt; 3.22.0-vc14_0 conda-forge [vc14] twisted: 18.9.0-py36he774522_0 --&gt; 18.7.0-py36hfa6e2cd_1 vc: 14.1-h0510ff6_4 --&gt; 14-h0510ff6_3 yaml: 0.1.7-hc54c509_2 --&gt; 0.1.7-vc14_0 conda-forge [vc14] zlib: 1.2.11-h8395fce_2 --&gt; 1.2.11-vc14_0 conda-forge [vc14] Proceed ([y]/n)? n </code></pre> <p></p> <p><br/></p> <p>NOTE: the conda version I have installed is 4.5.11 - I'm not sure if this is the most recent version and haven't been able to find a command or resource (other than <code>conda update conda</code>) to check what the most recent version is. I also had a similar problem when trying to <code>conda install websocket-client</code> when websocket client was already installed - I wonder if the current version of conda has trouble when the most recent version of a package is already installed.</p> <p>NOTE 2: <code>conda update --all</code> solved the environment in a reasonable amount of time (~1 min - I didn't time it precisely).</p> <h3>Steps to Reproduce</h3> <p><code> conda update -n base conda </code></p> <p>As I mentioned above, <code>conda install websocket-client</code> also hung at 'Solving environment' - I already had websocket-client version 0.53.0 installed when I tried to run the install command</p> <h2>Expected Behavior</h2> <p>Conda should either: 1. If the most recent version is installed, conda should promptly inform the user that an update isn't needed. 1. If a newer version is available, I'd expect Conda to solve the environment in a shorter period of time. I think that less than 1-2 minutes would be reasonable - 20+ minutes is too long</p> <h2>Environment Information</h2> <p>The output of: <code>conda info</code><p> </p> <p><code>active environment : base active env location : C:\Users\jmatt\Anaconda3 shell level : 1 user config file : C:\Users\jmatt\.condarc populated config files : C:\Users\jmatt\.condarc conda version : 4.5.11 conda-build version : 3.16.1 python version : 3.6.6.final.0 base environment : C:\Users\jmatt\Anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch package cache : C:\Users\jmatt\Anaconda3\pkgs C:\Users\jmatt\AppData\Local\conda\conda\pkgs envs directories : C:\Users\jmatt\Anaconda3\envs C:\Users\jmatt\AppData\Local\conda\conda\envs C:\Users\jmatt\.conda\envs platform : win-64 user-agent : conda/4.5.11 requests/2.19.1 CPython/3.6.6 Windows/10 Windows/10.0.17134 administrator : False netrc file : None offline mode : False</code> </p></p> <p>The output of: <code>conda config --show-sources</code><p> </p> <p><code>ssl_verify: True channels: - defaults - conda-forge</code> </p></p> <p>The output of: <code>conda list --show-channel-urls</code><p> </p> <p><code>(base) C:\Users\jmatt&gt;conda list --show-channel-urls packages in environment at C:\Users\jmatt\Anaconda3: Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36_0 defaults alabaster 0.7.12 py36_0 defaults anaconda custom py36h363777c_0 defaults anaconda-client 1.7.2 py36_0 defaults anaconda-navigator 1.9.2 py36_0 defaults anaconda-project 0.8.2 py36_0 defaults appdirs 1.4.3 py36h28b3542_0 defaults asn1crypto 0.24.0 py36_0 defaults astroid 2.0.4 py36_0 defaults astropy 3.0.5 py36he774522_0 defaults atomicwrites 1.2.1 py36_0 defaults attrs 18.2.0 py36h28b3542_0 defaults automat 0.7.0 py36_0 defaults babel 2.6.0 py36_0 defaults backcall 0.1.0 py36_0 defaults backports 1.0 py36_1 defaults backports.os 0.1.1 py36_0 defaults backports.shutil_get_terminal_size 1.0.0 py36_2 defaults beautifulsoup4 4.6.3 py36_0 defaults bitarray 0.8.3 py36hfa6e2cd_0 defaults bkcharts 0.2 py36h7e685f7_0 defaults blas 1.0 mkl defaults blaze 0.11.3 py36_0 defaults bleach 3.0.2 py36_0 defaults blosc 1.14.4 he51fdeb_0 defaults bokeh 0.13.0 py36_0 defaults boto 2.49.0 py36_0 defaults bottleneck 1.2.1 py36h452e1ab_1 defaults bzip2 1.0.6 hfa6e2cd_5 defaults ca-certificates 2018.03.07 0 defaults certifi 2018.10.15 py36_0 defaults cffi 1.11.5 py36h74b6da3_1 defaults chardet 3.0.4 py36_1 defaults click 7.0 py36_0 defaults cloudpickle 0.6.1 py36_0 defaults clyent 1.2.2 py36_1 defaults colorama 0.4.0 py36_0 defaults comtypes 1.1.7 py36_0 defaults conda 4.5.11 py36_0 defaults conda-build 3.16.1 py36_0 defaults conda-env 2.6.0 1 defaults conda-verify 3.1.1 py36_0 defaults console_shortcut 0.1.1 3 defaults constantly 15.1.0 py36h28b3542_0 defaults contextlib2 0.5.5 py36he5d52c0_0 defaults cryptography 2.3.1 py36h74b6da3_0 defaults curl 7.61.1 h2a8f88b_0 defaults cycler 0.10.0 py36h009560c_0 defaults cython 0.29 py36ha925a31_0 defaults cytoolz 0.9.0.1 py36hfa6e2cd_1 defaults dask 0.19.4 py36_0 defaults dask-core 0.19.4 py36_0 defaults datashape 0.5.4 py36_1 defaults decorator 4.3.0 py36_0 defaults defusedxml 0.5.0 py36_1 defaults distributed 1.23.3 py36_0 defaults docutils 0.14 py36h6012d8f_0 defaults entrypoints 0.2.3 py36_2 defaults et_xmlfile 1.0.1 py36h3d2d736_0 defaults fastcache 1.0.2 py36hfa6e2cd_2 defaults filelock 3.0.9 py36_0 defaults flask 1.0.2 py36_1 defaults flask-cors 3.0.6 py36_0 defaults freetype 2.9.1 ha9979f8_1 defaults future 0.16.0 py36_2 defaults geographiclib 1.49 py_0 conda-forge geopy 1.17.0 py_0 conda-forge get_terminal_size 1.0.0 h38e98db_0 defaults gevent 1.3.7 py36he774522_1 defaults glob2 0.6 py36_1 defaults greenlet 0.4.15 py36hfa6e2cd_0 defaults h5py 2.8.0 py36h3bdd7fb_2 defaults hdf5 1.10.2 hac2f561_1 defaults heapdict 1.0.0 py36_2 defaults html5lib 1.0.1 py36_0 defaults hyperlink 18.0.0 py36_0 defaults icc_rt 2017.0.4 h97af966_0 defaults icu 58.2 ha66f8fd_1 defaults idna 2.7 py36_0 defaults imageio 2.4.1 py36_0 defaults imagesize 1.1.0 py36_0 defaults importlib_metadata 0.6 py36_0 defaults incremental 17.5.0 py36_0 defaults intel-openmp 2019.0 118 defaults ipykernel 5.1.0 py36h39e3cac_0 defaults ipython 7.0.1 py36h39e3cac_0 defaults ipython_genutils 0.2.0 py36h3c5d0ee_0 defaults ipywidgets 7.4.2 py36_0 defaults isort 4.3.4 py36_0 defaults itsdangerous 1.0.0 py36_0 defaults jdcal 1.4 py36_0 defaults jedi 0.13.1 py36_0 defaults jinja2 2.10 py36_0 defaults jpeg 9b hb83a4c4_2 defaults jsonschema 2.6.0 py36h7636477_0 defaults jupyter 1.0.0 py36_7 defaults jupyter_client 5.2.3 py36_0 defaults jupyter_console 6.0.0 py36_0 defaults jupyter_core 4.4.0 py36_0 defaults jupyterlab 0.35.2 py36_0 defaults jupyterlab_launcher 0.13.1 py36_0 defaults jupyterlab_server 0.2.0 py36_0 defaults keyring 15.1.0 py36_0 defaults kiwisolver 1.0.1 py36h6538335_0 defaults krb5 1.16.1 h038dc86_6 defaults lazy-object-proxy 1.3.1 py36hfa6e2cd_2 defaults libarchive 3.3.3 h798a506_0 defaults libcurl 7.61.1 h2a8f88b_0 defaults libiconv 1.15 h1df5818_7 defaults libpng 1.6.35 h2a8f88b_0 defaults libsodium 1.0.16 h9d3ae62_0 defaults libssh2 1.8.0 hd619d38_4 defaults libtiff 4.0.9 h36446d0_2 defaults libxml2 2.9.8 hadb2253_1 defaults libxslt 1.1.32 hf6f1972_0 defaults llvmlite 0.25.0 py36_0 defaults locket 0.2.0 py36hfed976d_1 defaults lxml 4.2.5 py36hef2cd61_0 defaults lz4-c 1.8.1.2 h2fa13f4_0 defaults lzo 2.10 h6df0209_2 defaults m2w64-gcc-libgfortran 5.3.0 6 defaults m2w64-gcc-libs 5.3.0 7 defaults m2w64-gcc-libs-core 5.3.0 7 defaults m2w64-gmp 6.1.0 2 defaults m2w64-libwinpthread-git 5.0.0.4634.697f757 2 defaults markupsafe 1.0 py36hfa6e2cd_1 defaults matplotlib 3.0.0 py36hd159220_0 defaults mccabe 0.6.1 py36_1 defaults menuinst 1.4.14 py36hfa6e2cd_0 defaults mistune 0.8.4 py36he774522_0 defaults mkl 2019.0 118 defaults mkl-service 1.1.2 py36hb217b18_5 defaults mkl_fft 1.0.6 py36hdbbee80_0 defaults mkl_random 1.0.1 py36h77b88f5_1 defaults more-itertools 4.3.0 py36_0 defaults mpmath 1.0.0 py36_2 defaults msgpack-python 0.5.6 py36he980bc4_1 defaults msys2-conda-epoch 20160418 1 defaults multipledispatch 0.6.0 py36_0 defaults navigator-updater 0.2.1 py36_0 defaults nbconvert 5.3.1 py36_0 defaults nbformat 4.4.0 py36h3a5bc1b_0 defaults networkx 2.2 py36_1 defaults nltk 3.3.0 py36_0 defaults nose 1.3.7 py36_2 defaults notebook 5.7.0 py36_0 defaults numba 0.40.0 py36hf9181ef_0 defaults numexpr 2.6.8 py36h9ef55f4_0 defaults numpy 1.15.3 py36ha559c80_0 defaults numpy-base 1.15.3 py36h8128ebf_0 defaults numpydoc 0.8.0 py36_0 defaults odo 0.5.1 py36h7560279_0 defaults olefile 0.46 py36_0 defaults openpyxl 2.5.9 py36_0 defaults openssl 1.0.2p hfa6e2cd_0 defaults packaging 18.0 py36_0 defaults pandas 0.23.4 py36h830ac7b_0 defaults pandoc 2.2.3.2 0 defaults pandocfilters 1.4.2 py36_1 defaults parso 0.3.1 py36_0 defaults partd 0.3.9 py36_0 defaults path.py 11.5.0 py36_0 defaults pathlib2 2.3.2 py36_0 defaults patsy 0.5.0 py36_0 defaults pep8 1.7.1 py36_0 defaults pickleshare 0.7.5 py36_0 defaults pillow 5.3.0 py36hdc69c19_0 defaults pip 10.0.1 py36_0 defaults pkginfo 1.4.2 py36_1 defaults pluggy 0.8.0 py36_0 defaults ply 3.11 py36_0 defaults prometheus_client 0.4.2 py36_0 defaults prompt_toolkit 2.0.6 py36_0 defaults psutil 5.4.7 py36hfa6e2cd_0 defaults py 1.7.0 py36_0 defaults pyasn1 0.4.4 py36h28b3542_0 defaults pyasn1-modules 0.2.2 py36_0 defaults pycodestyle 2.4.0 py36_0 defaults pycosat 0.6.3 py36hfa6e2cd_0 defaults pycparser 2.19 py36_0 defaults pycrypto 2.6.1 py36hfa6e2cd_9 defaults pycurl 7.43.0.2 py36h74b6da3_0 defaults pyflakes 2.0.0 py36_0 defaults pygments 2.2.0 py36hb010967_0 defaults pyhamcrest 1.9.0 py36_2 defaults pylint 2.1.1 py36_0 defaults pyodbc 4.0.24 py36h6538335_0 defaults pyopenssl 18.0.0 py36_0 defaults pyparsing 2.2.2 py36_0 defaults pyqt 5.9.2 py36h6538335_2 defaults pysocks 1.6.8 py36_0 defaults pytables 3.4.4 py36he6f6034_0 defaults pytest 3.9.1 py36_0 defaults pytest-arraydiff 0.2 py36h39e3cac_0 defaults pytest-astropy 0.4.0 py36_0 defaults pytest-doctestplus 0.1.3 py36_0 defaults pytest-openfiles 0.3.0 py36_0 defaults pytest-remotedata 0.3.0 py36_0 defaults python 3.6.6 hea74fb7_0 defaults python-dateutil 2.7.3 py36_0 defaults python-libarchive-c 2.8 py36_6 defaults pytz 2018.5 py36_0 defaults pywavelets 1.0.1 py36h8c2d366_0 defaults pywin32 223 py36hfa6e2cd_1 defaults pywinpty 0.5.4 py36_0 defaults pyyaml 3.13 py36hfa6e2cd_0 defaults pyzmq 17.1.2 py36hfa6e2cd_0 defaults qt 5.9.6 vc14h1e9a669_2 defaults qtawesome 0.5.1 py36_1 defaults qtconsole 4.4.2 py36_0 defaults qtpy 1.5.2 py36_0 defaults requests 2.19.1 py36_0 defaults rope 0.11.0 py36_0 defaults ruamel_yaml 0.15.46 py36hfa6e2cd_0 defaults scikit-image 0.14.0 py36h6538335_1 defaults scikit-learn 0.20.0 py36heebcf9a_1 defaults scipy 1.1.0 py36h4f6bf74_1 defaults seaborn 0.9.0 py36_0 defaults send2trash 1.5.0 py36_0 defaults service_identity 17.0.0 py36h28b3542_0 defaults setuptools 40.4.3 py36_0 defaults simplegeneric 0.8.1 py36_2 defaults singledispatch 3.4.0.3 py36h17d0c80_0 defaults sip 4.19.8 py36h6538335_0 defaults six 1.11.0 py36_1 defaults snappy 1.1.7 h777316e_3 defaults snowballstemmer 1.2.1 py36h763602f_0 defaults sortedcollections 1.0.1 py36_0 defaults sortedcontainers 2.0.5 py36_0 defaults sphinx 1.8.1 py36_0 defaults sphinxcontrib 1.0 py36_1 defaults sphinxcontrib-websupport 1.1.0 py36_1 defaults spyder 3.3.1 py36_1 defaults spyder-kernels 0.2.6 py36_0 defaults sqlalchemy 1.2.12 py36he774522_0 defaults sqlite 3.25.2 hfa6e2cd_0 defaults statsmodels 0.9.0 py36h452e1ab_0 defaults sympy 1.3 py36_0 defaults tblib 1.3.2 py36h30f5020_0 defaults terminado 0.8.1 py36_1 defaults testpath 0.4.2 py36_0 defaults tk 8.6.8 hfa6e2cd_0 defaults toolz 0.9.0 py36_0 defaults tornado 5.1.1 py36hfa6e2cd_0 defaults tqdm 4.26.0 py36h28b3542_0 defaults traitlets 4.3.2 py36h096827d_0 defaults twisted 18.9.0 py36he774522_0 defaults typed-ast 1.1.0 py36hfa6e2cd_0 defaults typing 3.6.4 py36_0 defaults unicodecsv 0.14.1 py36h6450c06_0 defaults urllib3 1.23 py36_0 defaults vc 14.1 h0510ff6_4 defaults vs2015_runtime 14.15.26706 h3a45250_0 defaults wcwidth 0.1.7 py36h3d5aa90_0 defaults webencodings 0.5.1 py36_1 defaults websocket-client 0.53.0 py36_1000 conda-forge werkzeug 0.14.1 py36_0 defaults wheel 0.32.2 py36_0 defaults widgetsnbextension 3.4.2 py36_0 defaults win_inet_pton 1.0.1 py36_1 defaults win_unicode_console 0.5 py36hcdbd4b5_0 defaults wincertstore 0.2 py36h7fe50ca_0 defaults winpty 0.4.3 4 defaults wrapt 1.10.11 py36hfa6e2cd_2 defaults xlrd 1.1.0 py36_1 defaults xlsxwriter 1.1.2 py36_0 defaults xlwings 0.12.1 py36_0 defaults xlwt 1.3.0 py36h1a4751e_0 defaults xz 5.2.4 h2fa13f4_4 defaults yaml 0.1.7 hc54c509_2 defaults zeromq 4.2.5 he025d50_1 defaults zict 0.1.3 py36_0 defaults zlib 1.2.11 h8395fce_2 defaults zope 1.0 py36_1 defaults zope.interface 4.5.0 py36hfa6e2cd_0 defaults</code> </p></p>
0debug
static uint32_t fdctrl_read_data (fdctrl_t *fdctrl) { fdrive_t *cur_drv; uint32_t retval = 0; int pos, len; cur_drv = get_cur_drv(fdctrl); fdctrl->state &= ~FD_CTRL_SLEEP; if (FD_STATE(fdctrl->data_state) == FD_STATE_CMD) { FLOPPY_ERROR("can't read data in CMD state\n"); return 0; } pos = fdctrl->data_pos; if (FD_STATE(fdctrl->data_state) == FD_STATE_DATA) { pos %= FD_SECTOR_LEN; if (pos == 0) { len = fdctrl->data_len - fdctrl->data_pos; if (len > FD_SECTOR_LEN) len = FD_SECTOR_LEN; bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, len); } } retval = fdctrl->fifo[pos]; if (++fdctrl->data_pos == fdctrl->data_len) { fdctrl->data_pos = 0; if (FD_STATE(fdctrl->data_state) == FD_STATE_DATA) { fdctrl_stop_transfer(fdctrl, 0x20, 0x00, 0x00); } else { fdctrl_reset_fifo(fdctrl); fdctrl_reset_irq(fdctrl); } } FLOPPY_DPRINTF("data register: 0x%02x\n", retval); return retval; }
1threat
static int process_input(void) { InputFile *ifile; AVFormatContext *is; InputStream *ist; AVPacket pkt; int ret, i, j; ifile = select_input_file(); if (!ifile) { if (got_eagain()) { reset_eagain(); av_usleep(10000); return AVERROR(EAGAIN); } av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from.\n"); return AVERROR_EOF; } is = ifile->ctx; ret = get_input_packet(ifile, &pkt); if (ret == AVERROR(EAGAIN)) { ifile->eagain = 1; return ret; } if (ret < 0) { if (ret != AVERROR_EOF) { print_error(is->filename, ret); if (exit_on_error) exit(1); } ifile->eof_reached = 1; for (i = 0; i < ifile->nb_streams; i++) { ist = input_streams[ifile->ist_index + i]; if (ist->decoding_needed) output_packet(ist, NULL); for (j = 0; j < nb_output_streams; j++) { OutputStream *ost = output_streams[j]; if (ost->source_index == ifile->ist_index + i && (ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE)) ost->finished= 1; } } return AVERROR(EAGAIN); } reset_eagain(); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, is->streams[pkt.stream_index]); } if (pkt.stream_index >= ifile->nb_streams) goto discard_packet; ist = input_streams[ifile->ist_index + pkt.stream_index]; if (ist->discard) goto discard_packet; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts *= ist->ts_scale; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts *= ist->ts_scale; if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE && (is->iformat->flags & AVFMT_TS_DISCONT)) { int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); int64_t delta = pkt_dts - ist->next_dts; if ((FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE || pkt_dts + 1 < ist->last_dts) && !copy_ts) { ifile->ts_offset -= delta; av_log(NULL, AV_LOG_DEBUG, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, ifile->ts_offset); pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } ret = output_packet(ist, &pkt); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n", ist->file_index, ist->st->index); if (exit_on_error) exit(1); } discard_packet: av_free_packet(&pkt); return 0; }
1threat
Slice content erased after function call : <p>here is a golang behavior that I am trying to understand and change: I wrote a method to populate a structure with slices in Golang. It works within the method itself, but the slice content gets lost outside of the method. I want however to keep the content. It probably comes from the fact that the pointers inside the slice where deleted at the end of the populateslice method, but how should I write it to prevent this to happen, ie. keep the content in mystruct.myslice after the function call ?</p> <p>Here is how I wrote the code:</p> <pre><code>type BBDatacolumn struct { Data []string } type Mystruct struc { myslice []BBDatacolumn } //Method to populate the slice of the structure mystruct: func (self mystruct) populateslice() { for i:=0; i&lt;imax; i++ { bufferdatacolumn := NewBBDatacolumn() //Here, code to populate bufferdatacolumns self.myslice = append(self.myslice, bufferdatacolumn) } self.myslice.display() //Here, works fine: myslice contains the data of the BBDatacolumn correctly } //Later in the code (outside of the populateslice func): mystructinstance.populateslice() //Populates slice OK at the end of the function mystructinstance.display() //Problem: mystructinstance.myslice is empty: Instanciation of Mystruct does not contain the data in myslice anymore as it did inside the populateslice method </code></pre>
0debug
Declare Submenu in Opengl C++ : In main function, when I declerd submenu I got Two error. the first error in `GLint subMenu;` it says "GLint subMenu' previously declared here" The other error on `int subMenu;` it show that "redeclaration of 'int subMenu' Here is a part of main function int main(int argc, char** argv) { glutInit(&argc, argv); GLint subMenu; int subMenu; subMenu = glutCreateMenu (c_SubMenu); glutAddMenuEntry ("Red", 3); glutAddMenuEntry ("Green", 2); glutAddMenuEntry ("Blue", 1); glutAddMenuEntry ("White", 4); } Could any one explain how to declare Glint variable and int in the same time in order to solve this issue.
0debug
javascript array: make object property into array key : I have an array of objects like so: arr[0] = {name: 'name1', attribute1: 'a1Value1', attribute2: 'a2Value1'} arr[1] = {name: 'name2', attribute1: 'a1Value2', attribute2: 'a2Value2'} what I want to achive is to create second array with name attribute as array key so it looks like this: arr2[name1] = {attribute1: 'a1Value1', attribute2: 'a2Value1'} arr2[name2] = {attribute1: 'a1Value2', attribute2: 'a2Value2'} Is there an easy and efficient way to do it with underscoreJS or plain JS?
0debug
PHP Regex for replace alternative : <p>I have a requirement for which I am trying to find a regex pattern to replace the code. I understand that I can get normal regular expression for finding and replacing the text however reqirement is to find and replace the instance alternatively.</p> <p>For example, </p> <pre><code>{code} UPDATE tenants SET end_user_uuid = '32392464c8a19a15dd8dc982ae3d574b' WHERE end_user_uuid = '9e194bfeace6c2d17cc71cc15e84f93a' AND instance_id = '265358' AND domain = 'automobieljansen'; {code} Rollback: {code} UPDATE tenants SET end_user_uuid = '9e194bfeace6c2d17cc71cc15e84f93a' WHERE end_user_uuid = '32392464c8a19a15dd8dc982ae3d574b' AND instance_id = '265358' AND domain = 'automobieljansen'; {code} </code></pre> <p>This is the original text. I need to replace the first instance of the <code>{code}</code> to <code>&lt;pre&gt;</code> and the second instance of the <code>{code}</code> to <code>&lt;/pre&gt;</code></p> <p>Expected result</p> <pre><code>&lt;pre&gt; UPDATE tenants SET end_user_uuid = '32392464c8a19a15dd8dc982ae3d574b' WHERE end_user_uuid = '9e194bfeace6c2d17cc71cc15e84f93a' AND instance_id = '265358' AND domain = 'automobieljansen'; &lt;/pre&gt; Rollback: &lt;pre&gt; UPDATE tenants SET end_user_uuid = '9e194bfeace6c2d17cc71cc15e84f93a' WHERE end_user_uuid = '32392464c8a19a15dd8dc982ae3d574b' AND instance_id = '265358' AND domain = 'automobieljansen'; &lt;/pre&gt; </code></pre> <p>Any help on how to do this easily? </p>
0debug
C++ Builder: Convert binary code to AnsiString : <p>when I have binary code like '01010100011001010111001101110100", how can I convert this back to "test"?</p> <p>Thanks.</p>
0debug
Put a set of characters into list in python : <p>Essentially I want to put characters inside a list so I can make the for loop work.</p> <p>Example characters (supposedly listed individually vertically. not like this showing as one line) N/A N/A None Test Dev</p> <p>I want to put these characters into a list like below a = [N/A, N/A, None, Test, Dev]</p> <p>Reason is when I use for loop into these characters (let's say there are all inside "test_report". For loop is not working because it is reading the "test_report" as like this:</p> <pre><code>N / A N / A N o n e </code></pre> <pre><code>count = 0 for i in test_report: if i == "Test": count += 1 return count </code></pre>
0debug
convert uint16_t hexadecimal number to decimal in C : <p>I have browsed so many questions regarding converting hexadecimal number to a decimal number but I couldn't find a way to convert a uint_16t hexadecimal number to decimal number.Can you help me in this case?Thanks for any advice.</p>
0debug
int qemu_shutdown_requested_get(void) { return shutdown_requested; }
1threat
How to write a query that is an employee who has the highest sales to the customer who has made the most purchases.In Sql Server : I'm having trouble with this question in my Database homework And need to answer this question: **Which employee has the highest sales to the customer who has made the most purchases?** And these are my database tables [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/HujP6.png Please, help me to write this Query.
0debug
Git Push Error when uploding after commit : [enter image description here][1] some error is here.. add and remote, commit is perfect, I don't know why this error come help me.. [1]: https://i.stack.imgur.com/Pxzcg.png
0debug
static int qemu_rdma_alloc_pd_cq(RDMAContext *rdma) { rdma->pd = ibv_alloc_pd(rdma->verbs); if (!rdma->pd) { fprintf(stderr, "failed to allocate protection domain\n"); return -1; } rdma->comp_channel = ibv_create_comp_channel(rdma->verbs); if (!rdma->comp_channel) { fprintf(stderr, "failed to allocate completion channel\n"); goto err_alloc_pd_cq; } rdma->cq = ibv_create_cq(rdma->verbs, (RDMA_SIGNALED_SEND_MAX * 3), NULL, rdma->comp_channel, 0); if (!rdma->cq) { fprintf(stderr, "failed to allocate completion queue\n"); goto err_alloc_pd_cq; } return 0; err_alloc_pd_cq: if (rdma->pd) { ibv_dealloc_pd(rdma->pd); } if (rdma->comp_channel) { ibv_destroy_comp_channel(rdma->comp_channel); } rdma->pd = NULL; rdma->comp_channel = NULL; return -1; }
1threat
YouTube API V3 - Get recommended video for new feed : <p>As YouTube official documentation about implement and immigrate to API V3, they said:</p> <blockquote> <p>YouTube Data API (v2) functionality: <a href="https://developers.google.com/youtube/2.0/developers_guide_protocol_recommendations" rel="noreferrer">Retrieve video recommendations</a><br> The v3 API does not retrieve a list that only contains videos recommended for the current API user. However, you can use the v3 API to find recommended videos by calling the <strong>activities.list</strong> method and setting the <strong>home</strong> parameter value to true.</p> </blockquote> <p>But now the parameter <a href="https://developers.google.com/youtube/v3/docs/activities/list" rel="noreferrer"><strong><code>home</code></strong></a> has been deprecated too. Currently, when I set the <code>home</code> parameter to <code>true</code>, I only retrieve the recently uploaded video in the channel: <a href="https://www.youtube.com/channel/UCF0pVplsI8R5kcAqgtoRqoA" rel="noreferrer">Popular video in YouTube</a>. There are no video with <code>snippet.type=recommendation</code> at all.</p> <p>I need to show recommended videos of authenticated user in new feed, but seem like this feature is completely deprecated by YouTube. Anyone has solution for that?<br> Thanks first!</p>
0debug
Java, private access in main() : <p>I am studying for the OCA Exam and came across this code:</p> <pre><code>public class Driver { private void printColor(String color) { color = "purple"; System.out.print(color); } public static void main(String[] args) { new Driver().printColor("blue"); } } </code></pre> <p>The question asks "What is the outcome of this piece of code". I initially thought it will be "it does not compile" because you have an object instance trying to access a private method. But, it turns out to be "purple". </p> <p>Why is it "purple" and not "it does not compile"? I know the <code>Driver</code> instances lives in the same class it is declared in, but why it still have the privilege to access private methods?</p> <p>Thank you</p>
0debug
Spring Boot integration tests: @AutoConfigureMockMvc and context caching : <p>I'm building very basic web application using Spring Boot 1.5.1 and wanted to create integration tests for checking REST endpoints. As recomended by documentation, MockMvc might be used for it.</p> <p>Here is very simple test class:</p> <pre><code>package foo.bar.first; import ... @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class ApplicationTest1 { @Autowired private WebApplicationContext context; @Autowired private MockMvc mvc; @Test public void shouldStartWebApplicationContext() { assertThat(context).isNotNull(); } @Test public void shouldReplyToPing() throws Exception { mvc.perform(get("/ping")) .andExpect(status().isOk()); } } </code></pre> <p>As expected, it starts full application context and runs tests. </p> <p>Later I have created other similar test classes and noticed that brand <strong>new application context</strong> is started up for <strong>each test class</strong>. Experiments show that context is shared only between test classes from same package.</p> <p>For example, if same test class copied multiple times, then contexts are as follows:</p> <pre><code>foo.bar first ApplicationTest1 (shared context) ApplicationTest2 (shared context) second ApplicationTest3 (brand new context) </code></pre> <p>Also further investigations showed that it is related to <code>@AutoConfigureMockMvc</code> annotation. If the annotation and MockMvc related test cases are removed, then all three classes sucessfully <strong>share the same context</strong>.</p> <p>So the question is how to get <strong>shared context for all tests with MockMvc</strong>?</p> <p>Note: other resources suggest to use <code>MockMvcBuilders.webAppContextSetup(context).build()</code> for getting MockMvc instance, but it does not work for me (it does not involve filters when processing web requests).</p>
0debug
Django: MakeValid not working for a single object : I'm trying to use `MakeValid` for fixing my geometry fields. I can make it work by getting and updating in single line: from django.contrib.gis.db.models.functions import MakeValid MyModel.objects.filter(id=<id>).update(polygon=MakeValid('polygon')) but for some cases, I've to update `polygon` of a single `object` already existing in function (means I need not to do `.filter`/`.get`) which gives me an error. // np is an object of MyModel which has a field 'polygon' np.polygon = MakeValid(np.polygon) // np.save() TypeError: Cannot set MyModel SpatialProxy (MULTIPOLYGON) with value of type: <class 'django.contrib.gis.db.models.functions.MakeValid'> What am I doing wrong?
0debug
"==" always returning true. Anagram program : <p>I have made a simple function which checks if two words are an anagram by sorting and comparing the sorted values, however this program always returns true even if the words aren't anangrams. If I remove the .ToString() it evalutates as false. Any idea why it's doing this and any ideas on how to fix this?</p> <pre><code>public bool anagram(string word1, string word2) { char[] word1Arr = word1.ToArray(); char[] word2Arr = word2.ToArray(); Array.Sort(word1Arr); Array.Sort(word2Arr); Console.WriteLine(word1Arr); Console.WriteLine(word2Arr); if (word1Arr.ToString() == word2Arr.ToString()) { return true; } else { return false; } } </code></pre>
0debug
static void acpi_build_update(void *build_opaque, uint32_t offset) { AcpiBuildState *build_state = build_opaque; AcpiBuildTables tables; if (!build_state || build_state->patched) { return; } build_state->patched = 1; acpi_build_tables_init(&tables); acpi_build(build_state->guest_info, &tables); assert(acpi_data_len(tables.table_data) == build_state->table_size); qemu_ram_resize(build_state->table_ram, build_state->table_size, &error_abort); memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data, build_state->table_size); memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp)); memcpy(qemu_get_ram_ptr(build_state->linker_ram), tables.linker->data, build_state->linker_size); cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram, build_state->table_size); acpi_build_tables_cleanup(&tables, true); }
1threat
changed project from xampp folder to another folder and deleted previous xampp version : changed a working project folder to another folder and I have given permission too but now it wont work also it shows following error when I login file_put_contents(D:\Videos\htdocs\salesapp\storage\framework\views/34f87b7f19f81a3c49159deded5ed0b821a7e81d.php): failed to open stream: No such file or directory how can I solve this
0debug
int cpu_exec(CPUState *env1) { #define DECLARE_HOST_REGS 1 #include "hostregs_helper.h" #if defined(TARGET_SPARC) #if defined(reg_REGWPTR) uint32_t *saved_regwptr; #endif #endif int ret, interrupt_request; long (*gen_func)(void); TranslationBlock *tb; uint8_t *tc_ptr; if (cpu_halted(env1) == EXCP_HALTED) return EXCP_HALTED; cpu_single_env = env1; #define SAVE_HOST_REGS 1 #include "hostregs_helper.h" env = env1; SAVE_GLOBALS(); env_to_regs(); #if defined(TARGET_I386) CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); DF = 1 - (2 * ((env->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_SPARC) #if defined(reg_REGWPTR) saved_regwptr = REGWPTR; #endif #elif defined(TARGET_M68K) env->cc_op = CC_OP_FLAGS; env->cc_dest = env->sr & 0xf; env->cc_x = (env->sr >> 4) & 1; #elif defined(TARGET_ALPHA) #elif defined(TARGET_ARM) #elif defined(TARGET_PPC) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_CRIS) #else #error unsupported target CPU #endif env->exception_index = -1; for(;;) { if (setjmp(env->jmp_env) == 0) { env->current_tb = NULL; if (env->exception_index >= 0) { if (env->exception_index >= EXCP_INTERRUPT) { ret = env->exception_index; break; } else if (env->user_mode_only) { #if defined(TARGET_I386) do_interrupt_user(env->exception_index, env->exception_is_int, env->error_code, env->exception_next_eip); #endif ret = env->exception_index; break; } else { #if defined(TARGET_I386) do_interrupt(env->exception_index, env->exception_is_int, env->error_code, env->exception_next_eip, 0); env->old_exception = -1; #elif defined(TARGET_PPC) do_interrupt(env); #elif defined(TARGET_MIPS) do_interrupt(env); #elif defined(TARGET_SPARC) do_interrupt(env->exception_index); #elif defined(TARGET_ARM) do_interrupt(env); #elif defined(TARGET_SH4) do_interrupt(env); #elif defined(TARGET_ALPHA) do_interrupt(env); #elif defined(TARGET_CRIS) do_interrupt(env); #elif defined(TARGET_M68K) do_interrupt(0); #endif } env->exception_index = -1; } #ifdef USE_KQEMU if (kqemu_is_ok(env) && env->interrupt_request == 0) { int ret; env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK); ret = kqemu_cpu_exec(env); CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); DF = 1 - (2 * ((env->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); if (ret == 1) { longjmp(env->jmp_env, 1); } else if (ret == 2) { } else { if (env->interrupt_request != 0) { } else { longjmp(env->jmp_env, 1); } } } #endif T0 = 0; for(;;) { SAVE_GLOBALS(); interrupt_request = env->interrupt_request; if (__builtin_expect(interrupt_request, 0) #if defined(TARGET_I386) && env->hflags & HF_GIF_MASK #endif ) { if (interrupt_request & CPU_INTERRUPT_DEBUG) { env->interrupt_request &= ~CPU_INTERRUPT_DEBUG; env->exception_index = EXCP_DEBUG; cpu_loop_exit(); } #if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \ defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) if (interrupt_request & CPU_INTERRUPT_HALT) { env->interrupt_request &= ~CPU_INTERRUPT_HALT; env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(); } #endif #if defined(TARGET_I386) if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { svm_check_intercept(SVM_EXIT_SMI); env->interrupt_request &= ~CPU_INTERRUPT_SMI; do_smm_enter(); BREAK_CHAIN; } else if ((interrupt_request & CPU_INTERRUPT_NMI) && !(env->hflags & HF_NMI_MASK)) { env->interrupt_request &= ~CPU_INTERRUPT_NMI; env->hflags |= HF_NMI_MASK; do_interrupt(EXCP02_NMI, 0, 0, 0, 1); BREAK_CHAIN; } else if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK || env->hflags & HF_HIF_MASK) && !(env->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; svm_check_intercept(SVM_EXIT_INTR); env->interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "Servicing hardware INT=0x%02x\n", intno); } do_interrupt(intno, 0, 0, 0, 1); BREAK_CHAIN; #if !defined(CONFIG_USER_ONLY) } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) && (env->eflags & IF_MASK) && !(env->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; env->interrupt_request &= ~CPU_INTERRUPT_VIRQ; svm_check_intercept(SVM_EXIT_VINTR); intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector)); if (loglevel & CPU_LOG_TB_IN_ASM) fprintf(logfile, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt(intno, 0, 0, -1, 1); stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_ctl), ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_ctl)) & ~V_IRQ_MASK); BREAK_CHAIN; #endif } #elif defined(TARGET_PPC) #if 0 if ((interrupt_request & CPU_INTERRUPT_RESET)) { cpu_ppc_reset(env); } #endif if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) env->interrupt_request &= ~CPU_INTERRUPT_HARD; BREAK_CHAIN; } #elif defined(TARGET_MIPS) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->CP0_Status & env->CP0_Cause & CP0Ca_IP_mask) && (env->CP0_Status & (1 << CP0St_IE)) && !(env->CP0_Status & (1 << CP0St_EXL)) && !(env->CP0_Status & (1 << CP0St_ERL)) && !(env->hflags & MIPS_HFLAG_DM)) { env->exception_index = EXCP_EXT_INTERRUPT; env->error_code = 0; do_interrupt(env); BREAK_CHAIN; } #elif defined(TARGET_SPARC) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->psret != 0)) { int pil = env->interrupt_index & 15; int type = env->interrupt_index & 0xf0; if (((type == TT_EXTINT) && (pil == 15 || pil > env->psrpil)) || type != TT_EXTINT) { env->interrupt_request &= ~CPU_INTERRUPT_HARD; do_interrupt(env->interrupt_index); env->interrupt_index = 0; #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) cpu_check_irqs(env); #endif BREAK_CHAIN; } } else if (interrupt_request & CPU_INTERRUPT_TIMER) { env->interrupt_request &= ~CPU_INTERRUPT_TIMER; } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ && !(env->uncached_cpsr & CPSR_F)) { env->exception_index = EXCP_FIQ; do_interrupt(env); BREAK_CHAIN; } if (interrupt_request & CPU_INTERRUPT_HARD && ((IS_M(env) && env->regs[15] < 0xfffffff0) || !(env->uncached_cpsr & CPSR_I))) { env->exception_index = EXCP_IRQ; do_interrupt(env); BREAK_CHAIN; } #elif defined(TARGET_SH4) if (interrupt_request & CPU_INTERRUPT_HARD) { do_interrupt(env); BREAK_CHAIN; } #elif defined(TARGET_ALPHA) if (interrupt_request & CPU_INTERRUPT_HARD) { do_interrupt(env); BREAK_CHAIN; } #elif defined(TARGET_CRIS) if (interrupt_request & CPU_INTERRUPT_HARD) { do_interrupt(env); BREAK_CHAIN; } #elif defined(TARGET_M68K) if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { env->exception_index = env->pending_vector; do_interrupt(1); BREAK_CHAIN; } #endif if (env->interrupt_request & CPU_INTERRUPT_EXITTB) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; BREAK_CHAIN; } if (interrupt_request & CPU_INTERRUPT_EXIT) { env->interrupt_request &= ~CPU_INTERRUPT_EXIT; env->exception_index = EXCP_INTERRUPT; cpu_loop_exit(); } } #ifdef DEBUG_EXEC if ((loglevel & CPU_LOG_TB_CPU)) { regs_to_env(); #if defined(TARGET_I386) env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK); cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP); env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_ARM) cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_SPARC) REGWPTR = env->regbase + (env->cwp * 16); env->regwptr = REGWPTR; cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_PPC) cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_MIPS) cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_SH4) cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_ALPHA) cpu_dump_state(env, logfile, fprintf, 0); #elif defined(TARGET_CRIS) cpu_dump_state(env, logfile, fprintf, 0); #else #error unsupported target CPU #endif } #endif tb = tb_find_fast(); #ifdef DEBUG_EXEC if ((loglevel & CPU_LOG_EXEC)) { fprintf(logfile, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", (long)tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); } #endif RESTORE_GLOBALS(); { if (T0 != 0 && #if USE_KQEMU (env->kqemu_enabled != 2) && #endif tb->page_addr[1] == -1) { spin_lock(&tb_lock); tb_add_jump((TranslationBlock *)(long)(T0 & ~3), T0 & 3, tb); spin_unlock(&tb_lock); } } tc_ptr = tb->tc_ptr; env->current_tb = tb; gen_func = (void *)tc_ptr; #if defined(__sparc__) __asm__ __volatile__("call %0\n\t" "mov %%o7,%%i0" : : "r" (gen_func) : "i0", "i1", "i2", "i3", "i4", "i5", "o0", "o1", "o2", "o3", "o4", "o5", "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7"); #elif defined(__hppa__) asm volatile ("ble 0(%%sr4,%1)\n" "copy %%r31,%%r18\n" "copy %%r28,%0\n" : "=r" (T0) : "r" (gen_func) : "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"); #elif defined(__arm__) asm volatile ("mov pc, %0\n\t" ".global exec_loop\n\t" "exec_loop:\n\t" : : "r" (gen_func) : "r1", "r2", "r3", "r8", "r9", "r10", "r12", "r14"); #elif defined(__ia64) struct fptr { void *ip; void *gp; } fp; fp.ip = tc_ptr; fp.gp = code_gen_buffer + 2 * (1 << 20); (*(void (*)(void)) &fp)(); #else T0 = gen_func(); #endif env->current_tb = NULL; #if defined(TARGET_I386) && !defined(CONFIG_SOFTMMU) if (env->hflags & HF_SOFTMMU_MASK) { env->hflags &= ~HF_SOFTMMU_MASK; T0 = 0; } #endif #if defined(USE_KQEMU) #define MIN_CYCLE_BEFORE_SWITCH (100 * 1000) if (kqemu_is_ok(env) && (cpu_get_time_fast() - env->last_io_time) >= MIN_CYCLE_BEFORE_SWITCH) { cpu_loop_exit(); } #endif } } else { env_to_regs(); } } #if defined(TARGET_I386) env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK); #elif defined(TARGET_ARM) #elif defined(TARGET_SPARC) #if defined(reg_REGWPTR) REGWPTR = saved_regwptr; #endif #elif defined(TARGET_PPC) #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #else #error unsupported target CPU #endif RESTORE_GLOBALS(); #include "hostregs_helper.h" cpu_single_env = NULL; return ret; }
1threat
Android Using Firebase Analytics along with Google Analytics : <p>I'd love to know how I can use Firebase Analytics (FA) and Google Analytics (GA) simultaneously as FA doesn't provide real-time data and my apps already integrated with GA since the beginning. I'd like to continue using GA since all my analytic data started there when I first launched my apps. Meanwhile, I'd like to have my apps have FA integrated to get more info.</p> <p>I followed <a href="https://support.google.com/analytics/answer/2587086?hl=en">Using Firebase Analytics and Google Analytics together</a> and setup Google Tag Manager. It doesn't seem to be working for me. I do see FA dashboard being updated but nothing is showing up in GA.</p> <p>Any help is greatly appreciated!</p>
0debug
void aio_context_unref(AioContext *ctx) { g_source_unref(&ctx->source); }
1threat
int cache_insert(PageCache *cache, uint64_t addr, uint8_t *pdata) { CacheItem *it = NULL; g_assert(cache); g_assert(cache->page_cache); it = cache_get_by_addr(cache, addr); if (!it->it_data) { it->it_data = g_try_malloc(cache->page_size); if (!it->it_data) { DPRINTF("Error allocating page\n"); return -1; } cache->num_items++; } memcpy(it->it_data, pdata, cache->page_size); it->it_age = ++cache->max_item_age; it->it_addr = addr; return 0; }
1threat
How to get angular2 [innerHtml] to work : <p>I don't know what am doing wrong as no errors are report.</p> <p>I have a component class </p> <pre><code>import { Component, OnInit, ViewContainerRef } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { testhtml = "&lt;p&gt;Hello world&lt;/p&gt;"; constructor(){} } } </code></pre> <p>And in my template file, I do something like this:</p> <pre><code>&lt;div class="blog-post"&gt;[innerHtml]="testhtml"&lt;/div&gt; </code></pre> <p>But this doesn't seem to work. Is there something else I need to import?</p> <p>I am using angular-cli "version": "1.0.0-beta.26",</p>
0debug
static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) { VC9Context *v = avctx->priv_data; v->profile = get_bits(gb, 2); av_log(avctx, AV_LOG_DEBUG, "Profile: %i\n", v->profile); #if HAS_ADVANCED_PROFILE if (v->profile > PROFILE_MAIN) { v->level = get_bits(gb, 3); v->chromaformat = get_bits(gb, 2); if (v->chromaformat != 1) { av_log(avctx, AV_LOG_ERROR, "Only 4:2:0 chroma format supported\n"); return -1; } } else #endif { v->res_sm = get_bits(gb, 2); if (v->res_sm) { av_log(avctx, AV_LOG_ERROR, "Reserved RES_SM=%i is forbidden\n", v->res_sm); } } v->frmrtq_postproc = get_bits(gb, 3); v->bitrtq_postproc = get_bits(gb, 5); v->s.loop_filter = get_bits(gb, 1); #if HAS_ADVANCED_PROFILE if (v->profile <= PROFILE_MAIN) #endif { v->res_x8 = get_bits(gb, 1); if (v->res_x8) { av_log(avctx, AV_LOG_ERROR, "1 for reserved RES_X8 is forbidden\n"); } v->multires = get_bits(gb, 1); v->res_fasttx = get_bits(gb, 1); if (!v->res_fasttx) { av_log(avctx, AV_LOG_ERROR, "0 for reserved RES_FASTTX is forbidden\n"); } } v->fastuvmc = get_bits(gb, 1); if (!v->profile && !v->fastuvmc) { av_log(avctx, AV_LOG_ERROR, "FASTUVMC unavailable in Simple Profile\n"); return -1; } v->extended_mv = get_bits(gb, 1); if (!v->profile && v->extended_mv) { av_log(avctx, AV_LOG_ERROR, "Extended MVs unavailable in Simple Profile\n"); return -1; } v->dquant = get_bits(gb, 2); v->vstransform = get_bits(gb, 1); #if HAS_ADVANCED_PROFILE if (v->profile <= PROFILE_MAIN) #endif { v->res_transtab = get_bits(gb, 1); if (v->res_transtab) { av_log(avctx, AV_LOG_ERROR, "1 for reserved RES_TRANSTAB is forbidden\n"); return -1; } } v->overlap = get_bits(gb, 1); #if HAS_ADVANCED_PROFILE if (v->profile <= PROFILE_MAIN) #endif { v->s.resync_marker = get_bits(gb, 1); v->rangered = get_bits(gb, 1); } v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); v->quantizer_mode = get_bits(gb, 2); #if HAS_ADVANCED_PROFILE if (v->profile <= PROFILE_MAIN) #endif { v->finterpflag = get_bits(gb, 1); v->res_rtm_flag = get_bits(gb, 1); if (!v->res_rtm_flag) { av_log(avctx, AV_LOG_ERROR, "0 for reserved RES_RTM_FLAG is forbidden\n"); } #if TRACE av_log(avctx, AV_LOG_INFO, "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, MultiRes=%i, FastUVMV=%i, Extended MV=%i\n" "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n" "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n", v->profile, v->frmrtq_postproc, v->bitrtq_postproc, v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv, v->rangered, v->vstransform, v->overlap, v->s.resync_marker, v->dquant, v->quantizer_mode, avctx->max_b_frames ); return 0; #endif } #if HAS_ADVANCED_PROFILE else return decode_advanced_sequence_header(avctx, gb); #endif }
1threat
static int mipsnet_can_receive(void *opaque) { MIPSnetState *s = opaque; if (s->busy) return 0; return !mipsnet_buffer_full(s); }
1threat
static inline void check_privileged(DisasContext *s) { if (s->tb->flags & (PSW_MASK_PSTATE >> 32)) { gen_program_exception(s, PGM_PRIVILEGED); } }
1threat
static int tosa_dac_init(I2CSlave *i2c) { return 0; }
1threat
QList *qdict_get_qlist(const QDict *qdict, const char *key) { return qobject_to_qlist(qdict_get_obj(qdict, key, QTYPE_QLIST)); }
1threat
configure error installing R-3.3.2 on Ubuntu: checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required : <p>Trying to install R-3.3.2 but when I use <code>$./configure</code>, I keep getting the error:</p> <p><code>checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required</code></p>
0debug
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i, ret; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; const uint8_t *buf_start = buf; int mb_height, n_slices1; struct { uint8_t *buf; GetBitContext gb; int mby_start; } *slices = NULL, *tmp; if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { if (s->low_delay == 0 && s->next_picture_ptr) { if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(buf))) { const uint8_t *start, *end, *next; int size; next = buf; for (start = buf, end = buf + buf_size; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: if (avctx->hwaccel) buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_FIELD: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; break; } case VC1_CODE_ENTRYPOINT: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2 * 8); ff_vc1_decode_entry_point(avctx, v, &s->gb); break; case VC1_CODE_SLICE: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9); n_slices++; break; } } } } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { const uint8_t *divider; int buf_size3; divider = find_next_marker(buf, buf + buf_size); if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) { av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); goto err; } else { tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); } else { buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); v->two_sprites = get_bits1(&s->gb); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { if (v->new_sprite) { avctx->width = avctx->coded_width = v->sprite_width; avctx->height = avctx->coded_height = v->sprite_height; } else { goto image; } } } if (s->context_initialized && (s->width != avctx->coded_width || s->height != avctx->coded_height)) { ff_vc1_decode_end(avctx); } if (!s->context_initialized) { if (ff_msmpeg4_decode_init(avctx) < 0) goto err; if (ff_vc1_decode_init_alloc_tables(v) < 0) { ff_MPV_common_end(s); goto err; } s->low_delay = !avctx->has_b_frames || v->res_sprite; if (v->profile == PROFILE_ADVANCED) { s->h_edge_pos = avctx->coded_width; s->v_edge_pos = avctx->coded_height; } } v->pic_header_flag = 0; v->first_pic_header_flag = 1; if (v->profile < PROFILE_ADVANCED) { if (ff_vc1_parse_frame_header(v, &s->gb) < 0) { goto err; } } else { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { goto err; } } v->first_pic_header_flag = 0; if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); goto err; } s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { goto err; } if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) { goto end; } if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else s->next_p_frame_damaged = 0; } if (ff_MPV_frame_start(s, avctx) < 0) { goto err; } s->current_picture_ptr->f.repeat_pict = 0; if (v->rff) { s->current_picture_ptr->f.repeat_pict = 1; } else if (v->rptfrm) { s->current_picture_ptr->f.repeat_pict = v->rptfrm * 2; } s->me.qpel_put = s->dsp.put_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; if (avctx->hwaccel) { if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) goto err; if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) goto err; if (avctx->hwaccel->end_frame(avctx) < 0) goto err; } else { int header_ret = 0; ff_mpeg_er_frame_start(s); v->bits = buf_size * 8; v->end_mb_x = s->mb_width; if (v->field_mode) { s->current_picture.f.linesize[0] <<= 1; s->current_picture.f.linesize[1] <<= 1; s->current_picture.f.linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } mb_height = s->mb_height >> v->field_mode; if (!mb_height) { av_log(v->s.avctx, AV_LOG_ERROR, "Invalid mb_height.\n"); goto err; } for (i = 0; i <= n_slices; i++) { if (i > 0 && slices[i - 1].mby_start >= mb_height) { if (v->field_mode <= 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond " "picture boundary (%d >= %d)\n", i, slices[i - 1].mby_start, mb_height); continue; } v->second_field = 1; v->blocks_off = s->mb_width * s->mb_height << 1; v->mb_off = s->mb_stride * s->mb_height >> 1; } else { v->second_field = 0; v->blocks_off = 0; v->mb_off = 0; } if (i) { v->pic_header_flag = 0; if (v->field_mode && i == n_slices1 + 2) { if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } } if (header_ret < 0) continue; s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height); if (!v->field_mode || v->second_field) s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); else s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); ff_vc1_decode_blocks(v); if (i != n_slices) s->gb = slices[i].gb; } if (v->field_mode) { v->second_field = 0; s->current_picture.f.linesize[0] >>= 1; s->current_picture.f.linesize[1] >>= 1; s->current_picture.f.linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { FFSWAP(uint8_t *, v->mv_f_next[0], v->mv_f[0]); FFSWAP(uint8_t *, v->mv_f_next[1], v->mv_f[1]); } } av_dlog(s->avctx, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); if (!v->field_mode) ff_er_frame_end(&s->er); } ff_MPV_frame_end(s); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { image: avctx->width = avctx->coded_width = v->output_width; avctx->height = avctx->coded_height = v->output_height; if (avctx->skip_frame >= AVDISCARD_NONREF) goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if (vc1_decode_sprites(v, &s->gb)) goto err; #endif if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0) goto err; *got_frame = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->current_picture_ptr); *got_frame = 1; } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->last_picture_ptr); *got_frame = 1; } } end: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return buf_size; err: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return -1; }
1threat
static target_ulong disas_insn(CPUX86State *env, DisasContext *s, target_ulong pc_start) { int b, prefixes, aflag, dflag; int shift, ot; int modrm, reg, rm, mod, reg_addr, op, opreg, offset_addr, val; target_ulong next_eip, tval; int rex_w, rex_r; if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(pc_start); s->pc = pc_start; prefixes = 0; s->override = -1; rex_w = -1; rex_r = 0; #ifdef TARGET_X86_64 s->rex_x = 0; s->rex_b = 0; x86_64_hregs = 0; #endif s->rip_offset = 0; s->vex_l = 0; s->vex_v = 0; next_byte: b = cpu_ldub_code(env, s->pc); s->pc++; switch (b) { case 0xf3: prefixes |= PREFIX_REPZ; goto next_byte; case 0xf2: prefixes |= PREFIX_REPNZ; goto next_byte; case 0xf0: prefixes |= PREFIX_LOCK; goto next_byte; case 0x2e: s->override = R_CS; goto next_byte; case 0x36: s->override = R_SS; goto next_byte; case 0x3e: s->override = R_DS; goto next_byte; case 0x26: s->override = R_ES; goto next_byte; case 0x64: s->override = R_FS; goto next_byte; case 0x65: s->override = R_GS; goto next_byte; case 0x66: prefixes |= PREFIX_DATA; goto next_byte; case 0x67: prefixes |= PREFIX_ADR; goto next_byte; #ifdef TARGET_X86_64 case 0x40 ... 0x4f: if (CODE64(s)) { rex_w = (b >> 3) & 1; rex_r = (b & 0x4) << 1; s->rex_x = (b & 0x2) << 2; REX_B(s) = (b & 0x1) << 3; x86_64_hregs = 1; goto next_byte; break; #endif case 0xc5: case 0xc4: if (s->code32 && !s->vm86) { static const int pp_prefix[4] = { 0, PREFIX_DATA, PREFIX_REPZ, PREFIX_REPNZ }; int vex3, vex2 = cpu_ldub_code(env, s->pc); if (!CODE64(s) && (vex2 & 0xc0) != 0xc0) { break; s->pc++; if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ | PREFIX_LOCK | PREFIX_DATA)) { #ifdef TARGET_X86_64 if (x86_64_hregs) { #endif rex_r = (~vex2 >> 4) & 8; if (b == 0xc5) { vex3 = vex2; b = cpu_ldub_code(env, s->pc++); } else { #ifdef TARGET_X86_64 s->rex_x = (~vex2 >> 3) & 8; s->rex_b = (~vex2 >> 2) & 8; #endif vex3 = cpu_ldub_code(env, s->pc++); rex_w = (vex3 >> 7) & 1; switch (vex2 & 0x1f) { case 0x01: b = cpu_ldub_code(env, s->pc++) | 0x100; break; case 0x02: b = 0x138; break; case 0x03: b = 0x13a; break; default: s->vex_v = (~vex3 >> 3) & 0xf; s->vex_l = (vex3 >> 2) & 1; prefixes |= pp_prefix[vex3 & 3] | PREFIX_VEX; break; if (CODE64(s)) { dflag = (rex_w > 0 ? 2 : prefixes & PREFIX_DATA ? 0 : 1); aflag = (prefixes & PREFIX_ADR ? 1 : 2); } else { dflag = s->code32; if (prefixes & PREFIX_DATA) { dflag ^= 1; aflag = s->code32; if (prefixes & PREFIX_ADR) { aflag ^= 1; s->prefix = prefixes; s->aflag = aflag; s->dflag = dflag; if (prefixes & PREFIX_LOCK) gen_helper_lock(); reswitch: switch(b) { case 0x0f: b = cpu_ldub_code(env, s->pc++) | 0x100; goto reswitch; case 0x00 ... 0x05: case 0x08 ... 0x0d: case 0x10 ... 0x15: case 0x18 ... 0x1d: case 0x20 ... 0x25: case 0x28 ... 0x2d: case 0x30 ... 0x35: case 0x38 ... 0x3d: { int op, f, val; op = (b >> 3) & 7; f = (b >> 1) & 3; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; switch(f) { case 0: modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); opreg = OR_TMP0; } else if (op == OP_XORL && rm == reg) { xor_zero: set_cc_op(s, CC_OP_CLR); gen_op_movl_T0_0(); gen_op_mov_reg_T0(ot, reg); break; } else { opreg = rm; gen_op_mov_TN_reg(ot, 1, reg); gen_op(s, op, ot, opreg); break; case 1: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; reg = ((modrm >> 3) & 7) | rex_r; rm = (modrm & 7) | REX_B(s); if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0(ot + s->mem_index); } else if (op == OP_XORL && rm == reg) { goto xor_zero; } else { gen_op_mov_TN_reg(ot, 1, rm); gen_op(s, op, ot, reg); break; case 2: val = insn_get(env, s, ot); gen_op_movl_T1_im(val); gen_op(s, op, ot, OR_EAX); break; break; case 0x82: if (CODE64(s)) case 0x80: case 0x81: case 0x83: { int val; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); op = (modrm >> 3) & 7; if (mod != 3) { if (b == 0x83) s->rip_offset = 1; else s->rip_offset = insn_const_size(ot); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); opreg = OR_TMP0; } else { opreg = rm; switch(b) { default: case 0x80: case 0x81: case 0x82: val = insn_get(env, s, ot); break; case 0x83: val = (int8_t)insn_get(env, s, OT_BYTE); break; gen_op_movl_T1_im(val); gen_op(s, op, ot, opreg); break; case 0x40 ... 0x47: ot = dflag ? OT_LONG : OT_WORD; gen_inc(s, ot, OR_EAX + (b & 7), 1); break; case 0x48 ... 0x4f: ot = dflag ? OT_LONG : OT_WORD; gen_inc(s, ot, OR_EAX + (b & 7), -1); break; case 0xf6: case 0xf7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); op = (modrm >> 3) & 7; if (mod != 3) { if (op == 0) s->rip_offset = insn_const_size(ot); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0(ot + s->mem_index); } else { gen_op_mov_TN_reg(ot, 0, rm); switch(op) { case 0: val = insn_get(env, s, ot); gen_op_movl_T1_im(val); gen_op_testl_T0_T1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); break; case 2: tcg_gen_not_tl(cpu_T[0], cpu_T[0]); if (mod != 3) { gen_op_st_T0_A0(ot + s->mem_index); } else { gen_op_mov_reg_T0(ot, rm); break; case 3: tcg_gen_neg_tl(cpu_T[0], cpu_T[0]); if (mod != 3) { gen_op_st_T0_A0(ot + s->mem_index); } else { gen_op_mov_reg_T0(ot, rm); gen_op_update_neg_cc(); set_cc_op(s, CC_OP_SUBB + ot); break; case 4: switch(ot) { case OT_BYTE: gen_op_mov_TN_reg(OT_BYTE, 1, R_EAX); tcg_gen_ext8u_tl(cpu_T[0], cpu_T[0]); tcg_gen_ext8u_tl(cpu_T[1], cpu_T[1]); tcg_gen_mul_tl(cpu_T[0], cpu_T[0], cpu_T[1]); gen_op_mov_reg_T0(OT_WORD, R_EAX); tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]); tcg_gen_andi_tl(cpu_cc_src, cpu_T[0], 0xff00); set_cc_op(s, CC_OP_MULB); break; case OT_WORD: gen_op_mov_TN_reg(OT_WORD, 1, R_EAX); tcg_gen_ext16u_tl(cpu_T[0], cpu_T[0]); tcg_gen_ext16u_tl(cpu_T[1], cpu_T[1]); tcg_gen_mul_tl(cpu_T[0], cpu_T[0], cpu_T[1]); gen_op_mov_reg_T0(OT_WORD, R_EAX); tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]); tcg_gen_shri_tl(cpu_T[0], cpu_T[0], 16); gen_op_mov_reg_T0(OT_WORD, R_EDX); tcg_gen_mov_tl(cpu_cc_src, cpu_T[0]); set_cc_op(s, CC_OP_MULW); break; default: case OT_LONG: tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_regs[R_EAX]); tcg_gen_mulu2_i32(cpu_tmp2_i32, cpu_tmp3_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_regs[R_EAX], cpu_tmp2_i32); tcg_gen_extu_i32_tl(cpu_regs[R_EDX], cpu_tmp3_i32); tcg_gen_mov_tl(cpu_cc_dst, cpu_regs[R_EAX]); tcg_gen_mov_tl(cpu_cc_src, cpu_regs[R_EDX]); set_cc_op(s, CC_OP_MULL); break; #ifdef TARGET_X86_64 case OT_QUAD: tcg_gen_mulu2_i64(cpu_regs[R_EAX], cpu_regs[R_EDX], cpu_T[0], cpu_regs[R_EAX]); tcg_gen_mov_tl(cpu_cc_dst, cpu_regs[R_EAX]); tcg_gen_mov_tl(cpu_cc_src, cpu_regs[R_EDX]); set_cc_op(s, CC_OP_MULQ); break; #endif break; case 5: switch(ot) { case OT_BYTE: gen_op_mov_TN_reg(OT_BYTE, 1, R_EAX); tcg_gen_ext8s_tl(cpu_T[0], cpu_T[0]); tcg_gen_ext8s_tl(cpu_T[1], cpu_T[1]); tcg_gen_mul_tl(cpu_T[0], cpu_T[0], cpu_T[1]); gen_op_mov_reg_T0(OT_WORD, R_EAX); tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]); tcg_gen_ext8s_tl(cpu_tmp0, cpu_T[0]); tcg_gen_sub_tl(cpu_cc_src, cpu_T[0], cpu_tmp0); set_cc_op(s, CC_OP_MULB); break; case OT_WORD: gen_op_mov_TN_reg(OT_WORD, 1, R_EAX); tcg_gen_ext16s_tl(cpu_T[0], cpu_T[0]); tcg_gen_ext16s_tl(cpu_T[1], cpu_T[1]); tcg_gen_mul_tl(cpu_T[0], cpu_T[0], cpu_T[1]); gen_op_mov_reg_T0(OT_WORD, R_EAX); tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]); tcg_gen_ext16s_tl(cpu_tmp0, cpu_T[0]); tcg_gen_sub_tl(cpu_cc_src, cpu_T[0], cpu_tmp0); tcg_gen_shri_tl(cpu_T[0], cpu_T[0], 16); gen_op_mov_reg_T0(OT_WORD, R_EDX); set_cc_op(s, CC_OP_MULW); break; default: case OT_LONG: tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_regs[R_EAX]); tcg_gen_muls2_i32(cpu_tmp2_i32, cpu_tmp3_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_regs[R_EAX], cpu_tmp2_i32); tcg_gen_extu_i32_tl(cpu_regs[R_EDX], cpu_tmp3_i32); tcg_gen_sari_i32(cpu_tmp2_i32, cpu_tmp2_i32, 31); tcg_gen_mov_tl(cpu_cc_dst, cpu_regs[R_EAX]); tcg_gen_sub_i32(cpu_tmp2_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_cc_src, cpu_tmp2_i32); set_cc_op(s, CC_OP_MULL); break; #ifdef TARGET_X86_64 case OT_QUAD: tcg_gen_muls2_i64(cpu_regs[R_EAX], cpu_regs[R_EDX], cpu_T[0], cpu_regs[R_EAX]); tcg_gen_mov_tl(cpu_cc_dst, cpu_regs[R_EAX]); tcg_gen_sari_tl(cpu_cc_src, cpu_regs[R_EAX], 63); tcg_gen_sub_tl(cpu_cc_src, cpu_cc_src, cpu_regs[R_EDX]); set_cc_op(s, CC_OP_MULQ); break; #endif break; case 6: switch(ot) { case OT_BYTE: gen_jmp_im(pc_start - s->cs_base); gen_helper_divb_AL(cpu_env, cpu_T[0]); break; case OT_WORD: gen_jmp_im(pc_start - s->cs_base); gen_helper_divw_AX(cpu_env, cpu_T[0]); break; default: case OT_LONG: gen_jmp_im(pc_start - s->cs_base); gen_helper_divl_EAX(cpu_env, cpu_T[0]); break; #ifdef TARGET_X86_64 case OT_QUAD: gen_jmp_im(pc_start - s->cs_base); gen_helper_divq_EAX(cpu_env, cpu_T[0]); break; #endif break; case 7: switch(ot) { case OT_BYTE: gen_jmp_im(pc_start - s->cs_base); gen_helper_idivb_AL(cpu_env, cpu_T[0]); break; case OT_WORD: gen_jmp_im(pc_start - s->cs_base); gen_helper_idivw_AX(cpu_env, cpu_T[0]); break; default: case OT_LONG: gen_jmp_im(pc_start - s->cs_base); gen_helper_idivl_EAX(cpu_env, cpu_T[0]); break; #ifdef TARGET_X86_64 case OT_QUAD: gen_jmp_im(pc_start - s->cs_base); gen_helper_idivq_EAX(cpu_env, cpu_T[0]); break; #endif break; default: break; case 0xfe: case 0xff: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); op = (modrm >> 3) & 7; if (op >= 2 && b == 0xfe) { if (CODE64(s)) { if (op == 2 || op == 4) { ot = OT_QUAD; } else if (op == 3 || op == 5) { ot = dflag ? OT_LONG + (rex_w == 1) : OT_WORD; } else if (op == 6) { ot = dflag ? OT_QUAD : OT_WORD; if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); if (op >= 2 && op != 3 && op != 5) gen_op_ld_T0_A0(ot + s->mem_index); } else { gen_op_mov_TN_reg(ot, 0, rm); switch(op) { case 0: if (mod != 3) opreg = OR_TMP0; else opreg = rm; gen_inc(s, ot, opreg, 1); break; case 1: if (mod != 3) opreg = OR_TMP0; else opreg = rm; gen_inc(s, ot, opreg, -1); break; case 2: if (s->dflag == 0) gen_op_andl_T0_ffff(); next_eip = s->pc - s->cs_base; gen_movtl_T1_im(next_eip); gen_push_T1(s); gen_op_jmp_T0(); gen_eob(s); break; case 3: gen_op_ld_T1_A0(ot + s->mem_index); gen_add_A0_im(s, 1 << (ot - OT_WORD + 1)); gen_op_ldu_T0_A0(OT_WORD + s->mem_index); do_lcall: if (s->pe && !s->vm86) { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_lcall_protected(cpu_env, cpu_tmp2_i32, cpu_T[1], tcg_const_i32(dflag), tcg_const_i32(s->pc - pc_start)); } else { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_lcall_real(cpu_env, cpu_tmp2_i32, cpu_T[1], tcg_const_i32(dflag), tcg_const_i32(s->pc - s->cs_base)); gen_eob(s); break; case 4: if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_eob(s); break; case 5: gen_op_ld_T1_A0(ot + s->mem_index); gen_add_A0_im(s, 1 << (ot - OT_WORD + 1)); gen_op_ldu_T0_A0(OT_WORD + s->mem_index); do_ljmp: if (s->pe && !s->vm86) { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_ljmp_protected(cpu_env, cpu_tmp2_i32, cpu_T[1], tcg_const_i32(s->pc - pc_start)); } else { gen_op_movl_seg_T0_vm(R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); gen_eob(s); break; case 6: gen_push_T0(s); break; default: break; case 0x84: case 0x85: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_op_mov_TN_reg(ot, 1, reg); gen_op_testl_T0_T1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); break; case 0xa8: case 0xa9: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; val = insn_get(env, s, ot); gen_op_mov_TN_reg(ot, 0, OR_EAX); gen_op_movl_T1_im(val); gen_op_testl_T0_T1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); break; case 0x98: #ifdef TARGET_X86_64 if (dflag == 2) { gen_op_mov_TN_reg(OT_LONG, 0, R_EAX); tcg_gen_ext32s_tl(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(OT_QUAD, R_EAX); } else #endif if (dflag == 1) { gen_op_mov_TN_reg(OT_WORD, 0, R_EAX); tcg_gen_ext16s_tl(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(OT_LONG, R_EAX); } else { gen_op_mov_TN_reg(OT_BYTE, 0, R_EAX); tcg_gen_ext8s_tl(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(OT_WORD, R_EAX); break; case 0x99: #ifdef TARGET_X86_64 if (dflag == 2) { gen_op_mov_TN_reg(OT_QUAD, 0, R_EAX); tcg_gen_sari_tl(cpu_T[0], cpu_T[0], 63); gen_op_mov_reg_T0(OT_QUAD, R_EDX); } else #endif if (dflag == 1) { gen_op_mov_TN_reg(OT_LONG, 0, R_EAX); tcg_gen_ext32s_tl(cpu_T[0], cpu_T[0]); tcg_gen_sari_tl(cpu_T[0], cpu_T[0], 31); gen_op_mov_reg_T0(OT_LONG, R_EDX); } else { gen_op_mov_TN_reg(OT_WORD, 0, R_EAX); tcg_gen_ext16s_tl(cpu_T[0], cpu_T[0]); tcg_gen_sari_tl(cpu_T[0], cpu_T[0], 15); gen_op_mov_reg_T0(OT_WORD, R_EDX); break; case 0x1af: case 0x69: case 0x6b: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; if (b == 0x69) s->rip_offset = insn_const_size(ot); else if (b == 0x6b) s->rip_offset = 1; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); if (b == 0x69) { val = insn_get(env, s, ot); gen_op_movl_T1_im(val); } else if (b == 0x6b) { val = (int8_t)insn_get(env, s, OT_BYTE); gen_op_movl_T1_im(val); } else { gen_op_mov_TN_reg(ot, 1, reg); switch (ot) { #ifdef TARGET_X86_64 case OT_QUAD: tcg_gen_muls2_i64(cpu_regs[reg], cpu_T[1], cpu_T[0], cpu_T[1]); tcg_gen_mov_tl(cpu_cc_dst, cpu_regs[reg]); tcg_gen_sari_tl(cpu_cc_src, cpu_cc_dst, 63); tcg_gen_sub_tl(cpu_cc_src, cpu_cc_src, cpu_T[1]); break; #endif case OT_LONG: tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T[1]); tcg_gen_muls2_i32(cpu_tmp2_i32, cpu_tmp3_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); tcg_gen_sari_i32(cpu_tmp2_i32, cpu_tmp2_i32, 31); tcg_gen_mov_tl(cpu_cc_dst, cpu_regs[reg]); tcg_gen_sub_i32(cpu_tmp2_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_cc_src, cpu_tmp2_i32); break; default: tcg_gen_ext16s_tl(cpu_T[0], cpu_T[0]); tcg_gen_ext16s_tl(cpu_T[1], cpu_T[1]); tcg_gen_mul_tl(cpu_T[0], cpu_T[0], cpu_T[1]); tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]); tcg_gen_ext16s_tl(cpu_tmp0, cpu_T[0]); tcg_gen_sub_tl(cpu_cc_src, cpu_T[0], cpu_tmp0); gen_op_mov_reg_T0(ot, reg); break; set_cc_op(s, CC_OP_MULB + ot); break; case 0x1c0: case 0x1c1: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (mod == 3) { rm = (modrm & 7) | REX_B(s); gen_op_mov_TN_reg(ot, 0, reg); gen_op_mov_TN_reg(ot, 1, rm); gen_op_addl_T0_T1(); gen_op_mov_reg_T1(ot, reg); gen_op_mov_reg_T0(ot, rm); } else { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_mov_TN_reg(ot, 0, reg); gen_op_ld_T1_A0(ot + s->mem_index); gen_op_addl_T0_T1(); gen_op_st_T0_A0(ot + s->mem_index); gen_op_mov_reg_T1(ot, reg); gen_op_update2_cc(); set_cc_op(s, CC_OP_ADDB + ot); break; case 0x1b0: case 0x1b1: { int label1, label2; TCGv t0, t1, t2, a0; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; t0 = tcg_temp_local_new(); t1 = tcg_temp_local_new(); t2 = tcg_temp_local_new(); a0 = tcg_temp_local_new(); gen_op_mov_v_reg(ot, t1, reg); if (mod == 3) { rm = (modrm & 7) | REX_B(s); gen_op_mov_v_reg(ot, t0, rm); } else { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); tcg_gen_mov_tl(a0, cpu_A0); gen_op_ld_v(ot + s->mem_index, t0, a0); rm = 0; label1 = gen_new_label(); tcg_gen_mov_tl(t2, cpu_regs[R_EAX]); gen_extu(ot, t0); gen_extu(ot, t2); tcg_gen_brcond_tl(TCG_COND_EQ, t2, t0, label1); label2 = gen_new_label(); if (mod == 3) { gen_op_mov_reg_v(ot, R_EAX, t0); tcg_gen_br(label2); gen_set_label(label1); gen_op_mov_reg_v(ot, rm, t1); } else { gen_op_st_v(ot + s->mem_index, t0, a0); gen_op_mov_reg_v(ot, R_EAX, t0); tcg_gen_br(label2); gen_set_label(label1); gen_op_st_v(ot + s->mem_index, t1, a0); gen_set_label(label2); tcg_gen_mov_tl(cpu_cc_src, t0); tcg_gen_mov_tl(cpu_cc_srcT, t2); tcg_gen_sub_tl(cpu_cc_dst, t2, t0); set_cc_op(s, CC_OP_SUBB + ot); tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); tcg_temp_free(a0); break; case 0x1c7: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; if ((mod == 3) || ((modrm & 0x38) != 0x8)) #ifdef TARGET_X86_64 if (dflag == 2) { if (!(s->cpuid_ext_features & CPUID_EXT_CX16)) gen_jmp_im(pc_start - s->cs_base); gen_update_cc_op(s); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_helper_cmpxchg16b(cpu_env, cpu_A0); } else #endif { if (!(s->cpuid_features & CPUID_CX8)) gen_jmp_im(pc_start - s->cs_base); gen_update_cc_op(s); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_helper_cmpxchg8b(cpu_env, cpu_A0); set_cc_op(s, CC_OP_EFLAGS); break; case 0x50 ... 0x57: gen_op_mov_TN_reg(OT_LONG, 0, (b & 7) | REX_B(s)); gen_push_T0(s); break; case 0x58 ... 0x5f: if (CODE64(s)) { ot = dflag ? OT_QUAD : OT_WORD; } else { ot = dflag + OT_WORD; gen_pop_T0(s); gen_pop_update(s); gen_op_mov_reg_T0(ot, (b & 7) | REX_B(s)); break; case 0x60: if (CODE64(s)) gen_pusha(s); break; case 0x61: if (CODE64(s)) gen_popa(s); break; case 0x68: case 0x6a: if (CODE64(s)) { ot = dflag ? OT_QUAD : OT_WORD; } else { ot = dflag + OT_WORD; if (b == 0x68) val = insn_get(env, s, ot); else val = (int8_t)insn_get(env, s, OT_BYTE); gen_op_movl_T0_im(val); gen_push_T0(s); break; case 0x8f: if (CODE64(s)) { ot = dflag ? OT_QUAD : OT_WORD; } else { ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; gen_pop_T0(s); if (mod == 3) { gen_pop_update(s); rm = (modrm & 7) | REX_B(s); gen_op_mov_reg_T0(ot, rm); } else { s->popl_esp_hack = 1 << ot; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); s->popl_esp_hack = 0; gen_pop_update(s); break; case 0xc8: { int level; val = cpu_lduw_code(env, s->pc); s->pc += 2; level = cpu_ldub_code(env, s->pc++); gen_enter(s, val, level); break; case 0xc9: if (CODE64(s)) { gen_op_mov_TN_reg(OT_QUAD, 0, R_EBP); gen_op_mov_reg_T0(OT_QUAD, R_ESP); } else if (s->ss32) { gen_op_mov_TN_reg(OT_LONG, 0, R_EBP); gen_op_mov_reg_T0(OT_LONG, R_ESP); } else { gen_op_mov_TN_reg(OT_WORD, 0, R_EBP); gen_op_mov_reg_T0(OT_WORD, R_ESP); gen_pop_T0(s); if (CODE64(s)) { ot = dflag ? OT_QUAD : OT_WORD; } else { ot = dflag + OT_WORD; gen_op_mov_reg_T0(ot, R_EBP); gen_pop_update(s); break; case 0x06: case 0x0e: case 0x16: case 0x1e: if (CODE64(s)) gen_op_movl_T0_seg(b >> 3); gen_push_T0(s); break; case 0x1a0: case 0x1a8: gen_op_movl_T0_seg((b >> 3) & 7); gen_push_T0(s); break; case 0x07: case 0x17: case 0x1f: if (CODE64(s)) reg = b >> 3; gen_pop_T0(s); gen_movl_seg_T0(s, reg, pc_start - s->cs_base); gen_pop_update(s); if (reg == R_SS) { if (!(s->tb->flags & HF_INHIBIT_IRQ_MASK)) gen_helper_set_inhibit_irq(cpu_env); s->tf = 0; if (s->is_jmp) { gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 0x1a1: case 0x1a9: gen_pop_T0(s); gen_movl_seg_T0(s, (b >> 3) & 7, pc_start - s->cs_base); gen_pop_update(s); if (s->is_jmp) { gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 0x88: case 0x89: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; gen_ldst_modrm(env, s, modrm, ot, reg, 1); break; case 0xc6: case 0xc7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; if (mod != 3) { s->rip_offset = insn_const_size(ot); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); val = insn_get(env, s, ot); gen_op_movl_T0_im(val); if (mod != 3) gen_op_st_T0_A0(ot + s->mem_index); else gen_op_mov_reg_T0(ot, (modrm & 7) | REX_B(s)); break; case 0x8a: case 0x8b: if ((b & 1) == 0) ot = OT_BYTE; else ot = OT_WORD + dflag; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_op_mov_reg_T0(ot, reg); break; case 0x8e: modrm = cpu_ldub_code(env, s->pc++); reg = (modrm >> 3) & 7; if (reg >= 6 || reg == R_CS) gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 0); gen_movl_seg_T0(s, reg, pc_start - s->cs_base); if (reg == R_SS) { if (!(s->tb->flags & HF_INHIBIT_IRQ_MASK)) gen_helper_set_inhibit_irq(cpu_env); s->tf = 0; if (s->is_jmp) { gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 0x8c: modrm = cpu_ldub_code(env, s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (reg >= 6) gen_op_movl_T0_seg(reg); if (mod == 3) ot = OT_WORD + dflag; else ot = OT_WORD; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); break; case 0x1b6: case 0x1b7: case 0x1be: case 0x1bf: { int d_ot; d_ot = dflag + OT_WORD; ot = (b & 1) + OT_BYTE; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); if (mod == 3) { gen_op_mov_TN_reg(ot, 0, rm); switch(ot | (b & 8)) { case OT_BYTE: tcg_gen_ext8u_tl(cpu_T[0], cpu_T[0]); break; case OT_BYTE | 8: tcg_gen_ext8s_tl(cpu_T[0], cpu_T[0]); break; case OT_WORD: tcg_gen_ext16u_tl(cpu_T[0], cpu_T[0]); break; default: case OT_WORD | 8: tcg_gen_ext16s_tl(cpu_T[0], cpu_T[0]); break; gen_op_mov_reg_T0(d_ot, reg); } else { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); if (b & 8) { gen_op_lds_T0_A0(ot + s->mem_index); } else { gen_op_ldu_T0_A0(ot + s->mem_index); gen_op_mov_reg_T0(d_ot, reg); break; case 0x8d: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; if (mod == 3) reg = ((modrm >> 3) & 7) | rex_r; s->override = -1; val = s->addseg; s->addseg = 0; gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); s->addseg = val; gen_op_mov_reg_A0(ot - OT_WORD, reg); break; case 0xa0: case 0xa1: case 0xa2: case 0xa3: { target_ulong offset_addr; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; #ifdef TARGET_X86_64 if (s->aflag == 2) { offset_addr = cpu_ldq_code(env, s->pc); s->pc += 8; gen_op_movq_A0_im(offset_addr); } else #endif { if (s->aflag) { offset_addr = insn_get(env, s, OT_LONG); } else { offset_addr = insn_get(env, s, OT_WORD); gen_op_movl_A0_im(offset_addr); gen_add_A0_ds_seg(s); if ((b & 2) == 0) { gen_op_ld_T0_A0(ot + s->mem_index); gen_op_mov_reg_T0(ot, R_EAX); } else { gen_op_mov_TN_reg(ot, 0, R_EAX); gen_op_st_T0_A0(ot + s->mem_index); break; case 0xd7: #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_movq_A0_reg(R_EBX); gen_op_mov_TN_reg(OT_QUAD, 0, R_EAX); tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 0xff); tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_T[0]); } else #endif { gen_op_movl_A0_reg(R_EBX); gen_op_mov_TN_reg(OT_LONG, 0, R_EAX); tcg_gen_andi_tl(cpu_T[0], cpu_T[0], 0xff); tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_T[0]); if (s->aflag == 0) gen_op_andl_A0_ffff(); else tcg_gen_andi_tl(cpu_A0, cpu_A0, 0xffffffff); gen_add_A0_ds_seg(s); gen_op_ldu_T0_A0(OT_BYTE + s->mem_index); gen_op_mov_reg_T0(OT_BYTE, R_EAX); break; case 0xb0 ... 0xb7: val = insn_get(env, s, OT_BYTE); gen_op_movl_T0_im(val); gen_op_mov_reg_T0(OT_BYTE, (b & 7) | REX_B(s)); break; case 0xb8 ... 0xbf: #ifdef TARGET_X86_64 if (dflag == 2) { uint64_t tmp; tmp = cpu_ldq_code(env, s->pc); s->pc += 8; reg = (b & 7) | REX_B(s); gen_movtl_T0_im(tmp); gen_op_mov_reg_T0(OT_QUAD, reg); } else #endif { ot = dflag ? OT_LONG : OT_WORD; val = insn_get(env, s, ot); reg = (b & 7) | REX_B(s); gen_op_movl_T0_im(val); gen_op_mov_reg_T0(ot, reg); break; case 0x91 ... 0x97: do_xchg_reg_eax: ot = dflag + OT_WORD; reg = (b & 7) | REX_B(s); rm = R_EAX; goto do_xchg_reg; case 0x86: case 0x87: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (mod == 3) { rm = (modrm & 7) | REX_B(s); do_xchg_reg: gen_op_mov_TN_reg(ot, 0, reg); gen_op_mov_TN_reg(ot, 1, rm); gen_op_mov_reg_T0(ot, rm); gen_op_mov_reg_T1(ot, reg); } else { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_mov_TN_reg(ot, 0, reg); if (!(prefixes & PREFIX_LOCK)) gen_helper_lock(); gen_op_ld_T1_A0(ot + s->mem_index); gen_op_st_T0_A0(ot + s->mem_index); if (!(prefixes & PREFIX_LOCK)) gen_helper_unlock(); gen_op_mov_reg_T1(ot, reg); break; case 0xc4: op = R_ES; goto do_lxx; case 0xc5: op = R_DS; goto do_lxx; case 0x1b2: op = R_SS; goto do_lxx; case 0x1b4: op = R_FS; goto do_lxx; case 0x1b5: op = R_GS; do_lxx: ot = dflag ? OT_LONG : OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (mod == 3) gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0(ot + s->mem_index); gen_add_A0_im(s, 1 << (ot - OT_WORD + 1)); gen_op_ldu_T0_A0(OT_WORD + s->mem_index); gen_movl_seg_T0(s, op, pc_start - s->cs_base); gen_op_mov_reg_T1(ot, reg); if (s->is_jmp) { gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 0xc0: case 0xc1: shift = 2; grp2: { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; op = (modrm >> 3) & 7; if (mod != 3) { if (shift == 2) { s->rip_offset = 1; gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); opreg = OR_TMP0; } else { opreg = (modrm & 7) | REX_B(s); if (shift == 0) { gen_shift(s, op, ot, opreg, OR_ECX); } else { if (shift == 2) { shift = cpu_ldub_code(env, s->pc++); gen_shifti(s, op, ot, opreg, shift); break; case 0xd0: case 0xd1: shift = 1; goto grp2; case 0xd2: case 0xd3: shift = 0; goto grp2; case 0x1a4: op = 0; shift = 1; goto do_shiftd; case 0x1a5: op = 0; shift = 0; goto do_shiftd; case 0x1ac: op = 1; shift = 1; goto do_shiftd; case 0x1ad: op = 1; shift = 0; do_shiftd: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); reg = ((modrm >> 3) & 7) | rex_r; if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); opreg = OR_TMP0; } else { opreg = rm; gen_op_mov_TN_reg(ot, 1, reg); if (shift) { TCGv imm = tcg_const_tl(cpu_ldub_code(env, s->pc++)); gen_shiftd_rm_T1(s, ot, opreg, op, imm); tcg_temp_free(imm); } else { gen_shiftd_rm_T1(s, ot, opreg, op, cpu_regs[R_ECX]); break; case 0xd8 ... 0xdf: if (s->flags & (HF_EM_MASK | HF_TS_MASK)) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); break; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = ((b & 7) << 3) | ((modrm >> 3) & 7); if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); switch(op) { case 0x00 ... 0x07: case 0x10 ... 0x17: case 0x20 ... 0x27: case 0x30 ... 0x37: { int op1; op1 = op & 7; switch(op >> 4) { case 0: gen_op_ld_T0_A0(OT_LONG + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_flds_FT0(cpu_env, cpu_tmp2_i32); break; case 1: gen_op_ld_T0_A0(OT_LONG + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_fildl_FT0(cpu_env, cpu_tmp2_i32); break; case 2: tcg_gen_qemu_ld64(cpu_tmp1_i64, cpu_A0, (s->mem_index >> 2) - 1); gen_helper_fldl_FT0(cpu_env, cpu_tmp1_i64); break; case 3: default: gen_op_lds_T0_A0(OT_WORD + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_fildl_FT0(cpu_env, cpu_tmp2_i32); break; gen_helper_fp_arith_ST0_FT0(op1); if (op1 == 3) { gen_helper_fpop(cpu_env); break; case 0x08: case 0x0a: case 0x0b: case 0x18 ... 0x1b: case 0x28 ... 0x2b: case 0x38 ... 0x3b: switch(op & 7) { case 0: switch(op >> 4) { case 0: gen_op_ld_T0_A0(OT_LONG + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_flds_ST0(cpu_env, cpu_tmp2_i32); break; case 1: gen_op_ld_T0_A0(OT_LONG + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_fildl_ST0(cpu_env, cpu_tmp2_i32); break; case 2: tcg_gen_qemu_ld64(cpu_tmp1_i64, cpu_A0, (s->mem_index >> 2) - 1); gen_helper_fldl_ST0(cpu_env, cpu_tmp1_i64); break; case 3: default: gen_op_lds_T0_A0(OT_WORD + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_fildl_ST0(cpu_env, cpu_tmp2_i32); break; break; case 1: switch(op >> 4) { case 1: gen_helper_fisttl_ST0(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_LONG + s->mem_index); break; case 2: gen_helper_fisttll_ST0(cpu_tmp1_i64, cpu_env); tcg_gen_qemu_st64(cpu_tmp1_i64, cpu_A0, (s->mem_index >> 2) - 1); break; case 3: default: gen_helper_fistt_ST0(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_WORD + s->mem_index); break; gen_helper_fpop(cpu_env); break; default: switch(op >> 4) { case 0: gen_helper_fsts_ST0(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_LONG + s->mem_index); break; case 1: gen_helper_fistl_ST0(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_LONG + s->mem_index); break; case 2: gen_helper_fstl_ST0(cpu_tmp1_i64, cpu_env); tcg_gen_qemu_st64(cpu_tmp1_i64, cpu_A0, (s->mem_index >> 2) - 1); break; case 3: default: gen_helper_fist_ST0(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_WORD + s->mem_index); break; if ((op & 7) == 3) gen_helper_fpop(cpu_env); break; break; case 0x0c: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fldenv(cpu_env, cpu_A0, tcg_const_i32(s->dflag)); break; case 0x0d: gen_op_ld_T0_A0(OT_WORD + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_fldcw(cpu_env, cpu_tmp2_i32); break; case 0x0e: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fstenv(cpu_env, cpu_A0, tcg_const_i32(s->dflag)); break; case 0x0f: gen_helper_fnstcw(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_WORD + s->mem_index); break; case 0x1d: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fldt_ST0(cpu_env, cpu_A0); break; case 0x1f: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fstt_ST0(cpu_env, cpu_A0); gen_helper_fpop(cpu_env); break; case 0x2c: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_frstor(cpu_env, cpu_A0, tcg_const_i32(s->dflag)); break; case 0x2e: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fsave(cpu_env, cpu_A0, tcg_const_i32(s->dflag)); break; case 0x2f: gen_helper_fnstsw(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(OT_WORD + s->mem_index); break; case 0x3c: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fbld_ST0(cpu_env, cpu_A0); break; case 0x3e: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fbst_ST0(cpu_env, cpu_A0); gen_helper_fpop(cpu_env); break; case 0x3d: tcg_gen_qemu_ld64(cpu_tmp1_i64, cpu_A0, (s->mem_index >> 2) - 1); gen_helper_fildll_ST0(cpu_env, cpu_tmp1_i64); break; case 0x3f: gen_helper_fistll_ST0(cpu_tmp1_i64, cpu_env); tcg_gen_qemu_st64(cpu_tmp1_i64, cpu_A0, (s->mem_index >> 2) - 1); gen_helper_fpop(cpu_env); break; default: } else { opreg = rm; switch(op) { case 0x08: gen_helper_fpush(cpu_env); gen_helper_fmov_ST0_STN(cpu_env, tcg_const_i32((opreg + 1) & 7)); break; case 0x09: case 0x29: case 0x39: gen_helper_fxchg_ST0_STN(cpu_env, tcg_const_i32(opreg)); break; case 0x0a: switch(rm) { case 0: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fwait(cpu_env); break; default: break; case 0x0c: switch(rm) { case 0: gen_helper_fchs_ST0(cpu_env); break; case 1: gen_helper_fabs_ST0(cpu_env); break; case 4: gen_helper_fldz_FT0(cpu_env); gen_helper_fcom_ST0_FT0(cpu_env); break; case 5: gen_helper_fxam_ST0(cpu_env); break; default: break; case 0x0d: { switch(rm) { case 0: gen_helper_fpush(cpu_env); gen_helper_fld1_ST0(cpu_env); break; case 1: gen_helper_fpush(cpu_env); gen_helper_fldl2t_ST0(cpu_env); break; case 2: gen_helper_fpush(cpu_env); gen_helper_fldl2e_ST0(cpu_env); break; case 3: gen_helper_fpush(cpu_env); gen_helper_fldpi_ST0(cpu_env); break; case 4: gen_helper_fpush(cpu_env); gen_helper_fldlg2_ST0(cpu_env); break; case 5: gen_helper_fpush(cpu_env); gen_helper_fldln2_ST0(cpu_env); break; case 6: gen_helper_fpush(cpu_env); gen_helper_fldz_ST0(cpu_env); break; default: break; case 0x0e: switch(rm) { case 0: gen_helper_f2xm1(cpu_env); break; case 1: gen_helper_fyl2x(cpu_env); break; case 2: gen_helper_fptan(cpu_env); break; case 3: gen_helper_fpatan(cpu_env); break; case 4: gen_helper_fxtract(cpu_env); break; case 5: gen_helper_fprem1(cpu_env); break; case 6: gen_helper_fdecstp(cpu_env); break; default: case 7: gen_helper_fincstp(cpu_env); break; break; case 0x0f: switch(rm) { case 0: gen_helper_fprem(cpu_env); break; case 1: gen_helper_fyl2xp1(cpu_env); break; case 2: gen_helper_fsqrt(cpu_env); break; case 3: gen_helper_fsincos(cpu_env); break; case 5: gen_helper_fscale(cpu_env); break; case 4: gen_helper_frndint(cpu_env); break; case 6: gen_helper_fsin(cpu_env); break; default: case 7: gen_helper_fcos(cpu_env); break; break; case 0x00: case 0x01: case 0x04 ... 0x07: case 0x20: case 0x21: case 0x24 ... 0x27: case 0x30: case 0x31: case 0x34 ... 0x37: { int op1; op1 = op & 7; if (op >= 0x20) { gen_helper_fp_arith_STN_ST0(op1, opreg); if (op >= 0x30) gen_helper_fpop(cpu_env); } else { gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fp_arith_ST0_FT0(op1); break; case 0x02: case 0x22: gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fcom_ST0_FT0(cpu_env); break; case 0x03: case 0x23: case 0x32: gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fcom_ST0_FT0(cpu_env); gen_helper_fpop(cpu_env); break; case 0x15: switch(rm) { case 1: gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(1)); gen_helper_fucom_ST0_FT0(cpu_env); gen_helper_fpop(cpu_env); gen_helper_fpop(cpu_env); break; default: break; case 0x1c: switch(rm) { case 0: break; case 1: break; case 2: gen_helper_fclex(cpu_env); break; case 3: gen_helper_fninit(cpu_env); break; case 4: break; default: break; case 0x1d: gen_update_cc_op(s); gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fucomi_ST0_FT0(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x1e: gen_update_cc_op(s); gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fcomi_ST0_FT0(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x28: gen_helper_ffree_STN(cpu_env, tcg_const_i32(opreg)); break; case 0x2a: gen_helper_fmov_STN_ST0(cpu_env, tcg_const_i32(opreg)); break; case 0x2b: case 0x0b: case 0x3a: case 0x3b: gen_helper_fmov_STN_ST0(cpu_env, tcg_const_i32(opreg)); gen_helper_fpop(cpu_env); break; case 0x2c: gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fucom_ST0_FT0(cpu_env); break; case 0x2d: gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fucom_ST0_FT0(cpu_env); gen_helper_fpop(cpu_env); break; case 0x33: switch(rm) { case 1: gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(1)); gen_helper_fcom_ST0_FT0(cpu_env); gen_helper_fpop(cpu_env); gen_helper_fpop(cpu_env); break; default: break; case 0x38: gen_helper_ffree_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fpop(cpu_env); break; case 0x3c: switch(rm) { case 0: gen_helper_fnstsw(cpu_tmp2_i32, cpu_env); tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32); gen_op_mov_reg_T0(OT_WORD, R_EAX); break; default: break; case 0x3d: gen_update_cc_op(s); gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fucomi_ST0_FT0(cpu_env); gen_helper_fpop(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x3e: gen_update_cc_op(s); gen_helper_fmov_FT0_STN(cpu_env, tcg_const_i32(opreg)); gen_helper_fcomi_ST0_FT0(cpu_env); gen_helper_fpop(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x10 ... 0x13: case 0x18 ... 0x1b: { int op1, l1; static const uint8_t fcmov_cc[8] = { (JCC_B << 1), (JCC_Z << 1), (JCC_BE << 1), (JCC_P << 1), }; op1 = fcmov_cc[op & 3] | (((op >> 3) & 1) ^ 1); l1 = gen_new_label(); gen_jcc1_noeob(s, op1, l1); gen_helper_fmov_ST0_STN(cpu_env, tcg_const_i32(opreg)); gen_set_label(l1); break; default: break; case 0xa4: case 0xa5: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_movs(s, ot, pc_start - s->cs_base, s->pc - s->cs_base); } else { gen_movs(s, ot); break; case 0xaa: case 0xab: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_stos(s, ot, pc_start - s->cs_base, s->pc - s->cs_base); } else { gen_stos(s, ot); break; case 0xac: case 0xad: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_lods(s, ot, pc_start - s->cs_base, s->pc - s->cs_base); } else { gen_lods(s, ot); break; case 0xae: case 0xaf: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; if (prefixes & PREFIX_REPNZ) { gen_repz_scas(s, ot, pc_start - s->cs_base, s->pc - s->cs_base, 1); } else if (prefixes & PREFIX_REPZ) { gen_repz_scas(s, ot, pc_start - s->cs_base, s->pc - s->cs_base, 0); } else { gen_scas(s, ot); break; case 0xa6: case 0xa7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag + OT_WORD; if (prefixes & PREFIX_REPNZ) { gen_repz_cmps(s, ot, pc_start - s->cs_base, s->pc - s->cs_base, 1); } else if (prefixes & PREFIX_REPZ) { gen_repz_cmps(s, ot, pc_start - s->cs_base, s->pc - s->cs_base, 0); } else { gen_cmps(s, ot); break; case 0x6c: case 0x6d: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg(OT_WORD, 0, R_EDX); gen_op_andl_T0_ffff(); gen_check_io(s, ot, pc_start - s->cs_base, SVM_IOIO_TYPE_MASK | svm_is_rep(prefixes) | 4); if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_ins(s, ot, pc_start - s->cs_base, s->pc - s->cs_base); } else { gen_ins(s, ot); if (use_icount) { gen_jmp(s, s->pc - s->cs_base); break; case 0x6e: case 0x6f: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg(OT_WORD, 0, R_EDX); gen_op_andl_T0_ffff(); gen_check_io(s, ot, pc_start - s->cs_base, svm_is_rep(prefixes) | 4); if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) { gen_repz_outs(s, ot, pc_start - s->cs_base, s->pc - s->cs_base); } else { gen_outs(s, ot); if (use_icount) { gen_jmp(s, s->pc - s->cs_base); break; case 0xe4: case 0xe5: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = cpu_ldub_code(env, s->pc++); gen_op_movl_T0_im(val); gen_check_io(s, ot, pc_start - s->cs_base, SVM_IOIO_TYPE_MASK | svm_is_rep(prefixes)); if (use_icount) gen_io_start(); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_in_func(ot, cpu_T[1], cpu_tmp2_i32); gen_op_mov_reg_T1(ot, R_EAX); if (use_icount) { gen_io_end(); gen_jmp(s, s->pc - s->cs_base); break; case 0xe6: case 0xe7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = cpu_ldub_code(env, s->pc++); gen_op_movl_T0_im(val); gen_check_io(s, ot, pc_start - s->cs_base, svm_is_rep(prefixes)); gen_op_mov_TN_reg(ot, 1, R_EAX); if (use_icount) gen_io_start(); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T[1]); gen_helper_out_func(ot, cpu_tmp2_i32, cpu_tmp3_i32); if (use_icount) { gen_io_end(); gen_jmp(s, s->pc - s->cs_base); break; case 0xec: case 0xed: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg(OT_WORD, 0, R_EDX); gen_op_andl_T0_ffff(); gen_check_io(s, ot, pc_start - s->cs_base, SVM_IOIO_TYPE_MASK | svm_is_rep(prefixes)); if (use_icount) gen_io_start(); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_in_func(ot, cpu_T[1], cpu_tmp2_i32); gen_op_mov_reg_T1(ot, R_EAX); if (use_icount) { gen_io_end(); gen_jmp(s, s->pc - s->cs_base); break; case 0xee: case 0xef: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg(OT_WORD, 0, R_EDX); gen_op_andl_T0_ffff(); gen_check_io(s, ot, pc_start - s->cs_base, svm_is_rep(prefixes)); gen_op_mov_TN_reg(ot, 1, R_EAX); if (use_icount) gen_io_start(); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T[1]); gen_helper_out_func(ot, cpu_tmp2_i32, cpu_tmp3_i32); if (use_icount) { gen_io_end(); gen_jmp(s, s->pc - s->cs_base); break; case 0xc2: val = cpu_ldsw_code(env, s->pc); s->pc += 2; gen_pop_T0(s); if (CODE64(s) && s->dflag) s->dflag = 2; gen_stack_update(s, val + (2 << s->dflag)); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_eob(s); break; case 0xc3: gen_pop_T0(s); gen_pop_update(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_eob(s); break; case 0xca: val = cpu_ldsw_code(env, s->pc); s->pc += 2; do_lret: if (s->pe && !s->vm86) { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_lret_protected(cpu_env, tcg_const_i32(s->dflag), tcg_const_i32(val)); } else { gen_stack_A0(s); gen_op_ld_T0_A0(1 + s->dflag + s->mem_index); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_op_addl_A0_im(2 << s->dflag); gen_op_ld_T0_A0(1 + s->dflag + s->mem_index); gen_op_movl_seg_T0_vm(R_CS); gen_stack_update(s, val + (4 << s->dflag)); gen_eob(s); break; case 0xcb: val = 0; goto do_lret; case 0xcf: gen_svm_check_intercept(s, pc_start, SVM_EXIT_IRET); if (!s->pe) { gen_helper_iret_real(cpu_env, tcg_const_i32(s->dflag)); set_cc_op(s, CC_OP_EFLAGS); } else if (s->vm86) { if (s->iopl != 3) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_helper_iret_real(cpu_env, tcg_const_i32(s->dflag)); set_cc_op(s, CC_OP_EFLAGS); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_iret_protected(cpu_env, tcg_const_i32(s->dflag), tcg_const_i32(s->pc - s->cs_base)); set_cc_op(s, CC_OP_EFLAGS); gen_eob(s); break; case 0xe8: { if (dflag) tval = (int32_t)insn_get(env, s, OT_LONG); else tval = (int16_t)insn_get(env, s, OT_WORD); next_eip = s->pc - s->cs_base; tval += next_eip; if (s->dflag == 0) tval &= 0xffff; else if(!CODE64(s)) tval &= 0xffffffff; gen_movtl_T0_im(next_eip); gen_push_T0(s); gen_jmp(s, tval); break; case 0x9a: { unsigned int selector, offset; if (CODE64(s)) ot = dflag ? OT_LONG : OT_WORD; offset = insn_get(env, s, ot); selector = insn_get(env, s, OT_WORD); gen_op_movl_T0_im(selector); gen_op_movl_T1_imu(offset); goto do_lcall; case 0xe9: if (dflag) tval = (int32_t)insn_get(env, s, OT_LONG); else tval = (int16_t)insn_get(env, s, OT_WORD); tval += s->pc - s->cs_base; if (s->dflag == 0) tval &= 0xffff; else if(!CODE64(s)) tval &= 0xffffffff; gen_jmp(s, tval); break; case 0xea: { unsigned int selector, offset; if (CODE64(s)) ot = dflag ? OT_LONG : OT_WORD; offset = insn_get(env, s, ot); selector = insn_get(env, s, OT_WORD); gen_op_movl_T0_im(selector); gen_op_movl_T1_imu(offset); goto do_ljmp; case 0xeb: tval = (int8_t)insn_get(env, s, OT_BYTE); tval += s->pc - s->cs_base; if (s->dflag == 0) tval &= 0xffff; gen_jmp(s, tval); break; case 0x70 ... 0x7f: tval = (int8_t)insn_get(env, s, OT_BYTE); goto do_jcc; case 0x180 ... 0x18f: if (dflag) { tval = (int32_t)insn_get(env, s, OT_LONG); } else { tval = (int16_t)insn_get(env, s, OT_WORD); do_jcc: next_eip = s->pc - s->cs_base; tval += next_eip; if (s->dflag == 0) tval &= 0xffff; gen_jcc(s, b, tval, next_eip); break; case 0x190 ... 0x19f: modrm = cpu_ldub_code(env, s->pc++); gen_setcc1(s, b, cpu_T[0]); gen_ldst_modrm(env, s, modrm, OT_BYTE, OR_TMP0, 1); break; case 0x140 ... 0x14f: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; gen_cmovcc1(env, s, ot, b, modrm, reg); break; case 0x9c: gen_svm_check_intercept(s, pc_start, SVM_EXIT_PUSHF); if (s->vm86 && s->iopl != 3) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_helper_read_eflags(cpu_T[0], cpu_env); gen_push_T0(s); break; case 0x9d: gen_svm_check_intercept(s, pc_start, SVM_EXIT_POPF); if (s->vm86 && s->iopl != 3) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_pop_T0(s); if (s->cpl == 0) { if (s->dflag) { gen_helper_write_eflags(cpu_env, cpu_T[0], tcg_const_i32((TF_MASK | AC_MASK | ID_MASK | NT_MASK | IF_MASK | IOPL_MASK))); } else { gen_helper_write_eflags(cpu_env, cpu_T[0], tcg_const_i32((TF_MASK | AC_MASK | ID_MASK | NT_MASK | IF_MASK | IOPL_MASK) & 0xffff)); } else { if (s->cpl <= s->iopl) { if (s->dflag) { gen_helper_write_eflags(cpu_env, cpu_T[0], tcg_const_i32((TF_MASK | AC_MASK | ID_MASK | NT_MASK | IF_MASK))); } else { gen_helper_write_eflags(cpu_env, cpu_T[0], tcg_const_i32((TF_MASK | AC_MASK | ID_MASK | NT_MASK | IF_MASK) & 0xffff)); } else { if (s->dflag) { gen_helper_write_eflags(cpu_env, cpu_T[0], tcg_const_i32((TF_MASK | AC_MASK | ID_MASK | NT_MASK))); } else { gen_helper_write_eflags(cpu_env, cpu_T[0], tcg_const_i32((TF_MASK | AC_MASK | ID_MASK | NT_MASK) & 0xffff)); gen_pop_update(s); set_cc_op(s, CC_OP_EFLAGS); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 0x9e: if (CODE64(s) && !(s->cpuid_ext3_features & CPUID_EXT3_LAHF_LM)) gen_op_mov_TN_reg(OT_BYTE, 0, R_AH); gen_compute_eflags(s); tcg_gen_andi_tl(cpu_cc_src, cpu_cc_src, CC_O); tcg_gen_andi_tl(cpu_T[0], cpu_T[0], CC_S | CC_Z | CC_A | CC_P | CC_C); tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, cpu_T[0]); break; case 0x9f: if (CODE64(s) && !(s->cpuid_ext3_features & CPUID_EXT3_LAHF_LM)) gen_compute_eflags(s); tcg_gen_ori_tl(cpu_T[0], cpu_cc_src, 0x02); gen_op_mov_reg_T0(OT_BYTE, R_AH); break; case 0xf5: gen_compute_eflags(s); tcg_gen_xori_tl(cpu_cc_src, cpu_cc_src, CC_C); break; case 0xf8: gen_compute_eflags(s); tcg_gen_andi_tl(cpu_cc_src, cpu_cc_src, ~CC_C); break; case 0xf9: gen_compute_eflags(s); tcg_gen_ori_tl(cpu_cc_src, cpu_cc_src, CC_C); break; case 0xfc: tcg_gen_movi_i32(cpu_tmp2_i32, 1); tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, df)); break; case 0xfd: tcg_gen_movi_i32(cpu_tmp2_i32, -1); tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, df)); break; case 0x1ba: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); op = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); if (mod != 3) { s->rip_offset = 1; gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0(ot + s->mem_index); } else { gen_op_mov_TN_reg(ot, 0, rm); val = cpu_ldub_code(env, s->pc++); gen_op_movl_T1_im(val); if (op < 4) op -= 4; goto bt_op; case 0x1a3: op = 0; goto do_btx; case 0x1ab: op = 1; goto do_btx; case 0x1b3: op = 2; goto do_btx; case 0x1bb: op = 3; do_btx: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); gen_op_mov_TN_reg(OT_LONG, 1, reg); if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_exts(ot, cpu_T[1]); tcg_gen_sari_tl(cpu_tmp0, cpu_T[1], 3 + ot); tcg_gen_shli_tl(cpu_tmp0, cpu_tmp0, ot); tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0); gen_op_ld_T0_A0(ot + s->mem_index); } else { gen_op_mov_TN_reg(ot, 0, rm); bt_op: tcg_gen_andi_tl(cpu_T[1], cpu_T[1], (1 << (3 + ot)) - 1); switch(op) { case 0: tcg_gen_shr_tl(cpu_cc_src, cpu_T[0], cpu_T[1]); tcg_gen_movi_tl(cpu_cc_dst, 0); break; case 1: tcg_gen_shr_tl(cpu_tmp4, cpu_T[0], cpu_T[1]); tcg_gen_movi_tl(cpu_tmp0, 1); tcg_gen_shl_tl(cpu_tmp0, cpu_tmp0, cpu_T[1]); tcg_gen_or_tl(cpu_T[0], cpu_T[0], cpu_tmp0); break; case 2: tcg_gen_shr_tl(cpu_tmp4, cpu_T[0], cpu_T[1]); tcg_gen_movi_tl(cpu_tmp0, 1); tcg_gen_shl_tl(cpu_tmp0, cpu_tmp0, cpu_T[1]); tcg_gen_not_tl(cpu_tmp0, cpu_tmp0); tcg_gen_and_tl(cpu_T[0], cpu_T[0], cpu_tmp0); break; default: case 3: tcg_gen_shr_tl(cpu_tmp4, cpu_T[0], cpu_T[1]); tcg_gen_movi_tl(cpu_tmp0, 1); tcg_gen_shl_tl(cpu_tmp0, cpu_tmp0, cpu_T[1]); tcg_gen_xor_tl(cpu_T[0], cpu_T[0], cpu_tmp0); break; set_cc_op(s, CC_OP_SARB + ot); if (op != 0) { if (mod != 3) gen_op_st_T0_A0(ot + s->mem_index); else gen_op_mov_reg_T0(ot, rm); tcg_gen_mov_tl(cpu_cc_src, cpu_tmp4); tcg_gen_movi_tl(cpu_cc_dst, 0); break; case 0x1bc: case 0x1bd: ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_extu(ot, cpu_T[0]); if ((prefixes & PREFIX_REPZ) && (b & 1 ? s->cpuid_ext3_features & CPUID_EXT3_ABM : s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1)) { int size = 8 << ot; tcg_gen_mov_tl(cpu_cc_src, cpu_T[0]); if (b & 1) { gen_helper_clz(cpu_T[0], cpu_T[0]); tcg_gen_subi_tl(cpu_T[0], cpu_T[0], TARGET_LONG_BITS - size); } else { target_ulong mask = (target_ulong)-2 << (size - 1); tcg_gen_ori_tl(cpu_T[0], cpu_T[0], mask); gen_helper_ctz(cpu_T[0], cpu_T[0]); gen_op_update1_cc(); set_cc_op(s, CC_OP_BMILGB + ot); } else { tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]); set_cc_op(s, CC_OP_LOGICB + ot); if (b & 1) { gen_helper_clz(cpu_T[0], cpu_T[0]); tcg_gen_xori_tl(cpu_T[0], cpu_T[0], TARGET_LONG_BITS - 1); } else { gen_helper_ctz(cpu_T[0], cpu_T[0]); tcg_gen_movi_tl(cpu_tmp0, 0); tcg_gen_movcond_tl(TCG_COND_EQ, cpu_T[0], cpu_cc_dst, cpu_tmp0, cpu_regs[reg], cpu_T[0]); gen_op_mov_reg_T0(ot, reg); break; case 0x27: if (CODE64(s)) gen_update_cc_op(s); gen_helper_daa(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x2f: if (CODE64(s)) gen_update_cc_op(s); gen_helper_das(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x37: if (CODE64(s)) gen_update_cc_op(s); gen_helper_aaa(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0x3f: if (CODE64(s)) gen_update_cc_op(s); gen_helper_aas(cpu_env); set_cc_op(s, CC_OP_EFLAGS); break; case 0xd4: if (CODE64(s)) val = cpu_ldub_code(env, s->pc++); if (val == 0) { gen_exception(s, EXCP00_DIVZ, pc_start - s->cs_base); } else { gen_helper_aam(cpu_env, tcg_const_i32(val)); set_cc_op(s, CC_OP_LOGICB); break; case 0xd5: if (CODE64(s)) val = cpu_ldub_code(env, s->pc++); gen_helper_aad(cpu_env, tcg_const_i32(val)); set_cc_op(s, CC_OP_LOGICB); break; case 0x90: if (prefixes & PREFIX_LOCK) { if (REX_B(s)) { goto do_xchg_reg_eax; if (prefixes & PREFIX_REPZ) { gen_svm_check_intercept(s, pc_start, SVM_EXIT_PAUSE); break; case 0x9b: if ((s->flags & (HF_MP_MASK | HF_TS_MASK)) == (HF_MP_MASK | HF_TS_MASK)) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fwait(cpu_env); break; case 0xcc: gen_interrupt(s, EXCP03_INT3, pc_start - s->cs_base, s->pc - s->cs_base); break; case 0xcd: val = cpu_ldub_code(env, s->pc++); if (s->vm86 && s->iopl != 3) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_interrupt(s, val, pc_start - s->cs_base, s->pc - s->cs_base); break; case 0xce: if (CODE64(s)) gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_into(cpu_env, tcg_const_i32(s->pc - pc_start)); break; #ifdef WANT_ICEBP case 0xf1: gen_svm_check_intercept(s, pc_start, SVM_EXIT_ICEBP); #if 1 gen_debug(s, pc_start - s->cs_base); #else tb_flush(env); qemu_set_log(CPU_LOG_INT | CPU_LOG_TB_IN_ASM); #endif break; #endif case 0xfa: if (!s->vm86) { if (s->cpl <= s->iopl) { gen_helper_cli(cpu_env); } else { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { if (s->iopl == 3) { gen_helper_cli(cpu_env); } else { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; case 0xfb: if (!s->vm86) { if (s->cpl <= s->iopl) { gen_sti: gen_helper_sti(cpu_env); if (!(s->tb->flags & HF_INHIBIT_IRQ_MASK)) gen_helper_set_inhibit_irq(cpu_env); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); } else { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { if (s->iopl == 3) { goto gen_sti; } else { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; case 0x62: if (CODE64(s)) ot = dflag ? OT_LONG : OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) gen_op_mov_TN_reg(ot, 0, reg); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_jmp_im(pc_start - s->cs_base); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); if (ot == OT_WORD) { gen_helper_boundw(cpu_env, cpu_A0, cpu_tmp2_i32); } else { gen_helper_boundl(cpu_env, cpu_A0, cpu_tmp2_i32); break; case 0x1c8 ... 0x1cf: reg = (b & 7) | REX_B(s); #ifdef TARGET_X86_64 if (dflag == 2) { gen_op_mov_TN_reg(OT_QUAD, 0, reg); tcg_gen_bswap64_i64(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(OT_QUAD, reg); } else #endif { gen_op_mov_TN_reg(OT_LONG, 0, reg); tcg_gen_ext32u_tl(cpu_T[0], cpu_T[0]); tcg_gen_bswap32_tl(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(OT_LONG, reg); break; case 0xd6: if (CODE64(s)) gen_compute_eflags_c(s, cpu_T[0]); tcg_gen_neg_tl(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(OT_BYTE, R_EAX); break; case 0xe0: case 0xe1: case 0xe2: case 0xe3: { int l1, l2, l3; tval = (int8_t)insn_get(env, s, OT_BYTE); next_eip = s->pc - s->cs_base; tval += next_eip; if (s->dflag == 0) tval &= 0xffff; l1 = gen_new_label(); l2 = gen_new_label(); l3 = gen_new_label(); b &= 3; switch(b) { case 0: case 1: gen_op_add_reg_im(s->aflag, R_ECX, -1); gen_op_jz_ecx(s->aflag, l3); gen_jcc1(s, (JCC_Z << 1) | (b ^ 1), l1); break; case 2: gen_op_add_reg_im(s->aflag, R_ECX, -1); gen_op_jnz_ecx(s->aflag, l1); break; default: case 3: gen_op_jz_ecx(s->aflag, l1); break; gen_set_label(l3); gen_jmp_im(next_eip); tcg_gen_br(l2); gen_set_label(l1); gen_jmp_im(tval); gen_set_label(l2); gen_eob(s); break; case 0x130: case 0x132: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); if (b & 2) { gen_helper_rdmsr(cpu_env); } else { gen_helper_wrmsr(cpu_env); break; case 0x131: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); if (use_icount) gen_io_start(); gen_helper_rdtsc(cpu_env); if (use_icount) { gen_io_end(); gen_jmp(s, s->pc - s->cs_base); break; case 0x133: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_rdpmc(cpu_env); break; case 0x134: if (CODE64(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) if (!s->pe) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_sysenter(cpu_env); gen_eob(s); break; case 0x135: if (CODE64(s) && env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1) if (!s->pe) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_sysexit(cpu_env, tcg_const_i32(dflag)); gen_eob(s); break; #ifdef TARGET_X86_64 case 0x105: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_syscall(cpu_env, tcg_const_i32(s->pc - pc_start)); gen_eob(s); break; case 0x107: if (!s->pe) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_sysret(cpu_env, tcg_const_i32(s->dflag)); if (s->lma) { set_cc_op(s, CC_OP_EFLAGS); gen_eob(s); break; #endif case 0x1a2: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_cpuid(cpu_env); break; case 0xf4: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_hlt(cpu_env, tcg_const_i32(s->pc - pc_start)); s->is_jmp = DISAS_TB_JUMP; break; case 0x100: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; op = (modrm >> 3) & 7; switch(op) { case 0: if (!s->pe || s->vm86) gen_svm_check_intercept(s, pc_start, SVM_EXIT_LDTR_READ); tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,ldt.selector)); ot = OT_WORD; if (mod == 3) ot += s->dflag; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); break; case 2: if (!s->pe || s->vm86) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_svm_check_intercept(s, pc_start, SVM_EXIT_LDTR_WRITE); gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 0); gen_jmp_im(pc_start - s->cs_base); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_lldt(cpu_env, cpu_tmp2_i32); break; case 1: if (!s->pe || s->vm86) gen_svm_check_intercept(s, pc_start, SVM_EXIT_TR_READ); tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,tr.selector)); ot = OT_WORD; if (mod == 3) ot += s->dflag; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); break; case 3: if (!s->pe || s->vm86) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_svm_check_intercept(s, pc_start, SVM_EXIT_TR_WRITE); gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 0); gen_jmp_im(pc_start - s->cs_base); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_ltr(cpu_env, cpu_tmp2_i32); break; case 4: case 5: if (!s->pe || s->vm86) gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 0); gen_update_cc_op(s); if (op == 4) { gen_helper_verr(cpu_env, cpu_T[0]); } else { gen_helper_verw(cpu_env, cpu_T[0]); set_cc_op(s, CC_OP_EFLAGS); break; default: break; case 0x101: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; op = (modrm >> 3) & 7; rm = modrm & 7; switch(op) { case 0: if (mod == 3) gen_svm_check_intercept(s, pc_start, SVM_EXIT_GDTR_READ); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State, gdt.limit)); gen_op_st_T0_A0(OT_WORD + s->mem_index); gen_add_A0_im(s, 2); tcg_gen_ld_tl(cpu_T[0], cpu_env, offsetof(CPUX86State, gdt.base)); if (!s->dflag) gen_op_andl_T0_im(0xffffff); gen_op_st_T0_A0(CODE64(s) + OT_LONG + s->mem_index); break; case 1: if (mod == 3) { switch (rm) { case 0: if (!(s->cpuid_ext_features & CPUID_EXT_MONITOR) || s->cpl != 0) gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_movq_A0_reg(R_EAX); } else #endif { gen_op_movl_A0_reg(R_EAX); if (s->aflag == 0) gen_op_andl_A0_ffff(); gen_add_A0_ds_seg(s); gen_helper_monitor(cpu_env, cpu_A0); break; case 1: if (!(s->cpuid_ext_features & CPUID_EXT_MONITOR) || s->cpl != 0) gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_mwait(cpu_env, tcg_const_i32(s->pc - pc_start)); gen_eob(s); break; case 2: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_SMAP) || s->cpl != 0) { gen_helper_clac(cpu_env); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 3: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_SMAP) || s->cpl != 0) { gen_helper_stac(cpu_env); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; default: } else { gen_svm_check_intercept(s, pc_start, SVM_EXIT_IDTR_READ); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State, idt.limit)); gen_op_st_T0_A0(OT_WORD + s->mem_index); gen_add_A0_im(s, 2); tcg_gen_ld_tl(cpu_T[0], cpu_env, offsetof(CPUX86State, idt.base)); if (!s->dflag) gen_op_andl_T0_im(0xffffff); gen_op_st_T0_A0(CODE64(s) + OT_LONG + s->mem_index); break; case 2: case 3: if (mod == 3) { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); switch(rm) { case 0: if (!(s->flags & HF_SVME_MASK) || !s->pe) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { gen_helper_vmrun(cpu_env, tcg_const_i32(s->aflag), tcg_const_i32(s->pc - pc_start)); tcg_gen_exit_tb(0); s->is_jmp = DISAS_TB_JUMP; break; case 1: if (!(s->flags & HF_SVME_MASK)) gen_helper_vmmcall(cpu_env); break; case 2: if (!(s->flags & HF_SVME_MASK) || !s->pe) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { gen_helper_vmload(cpu_env, tcg_const_i32(s->aflag)); break; case 3: if (!(s->flags & HF_SVME_MASK) || !s->pe) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { gen_helper_vmsave(cpu_env, tcg_const_i32(s->aflag)); break; case 4: if ((!(s->flags & HF_SVME_MASK) && !(s->cpuid_ext3_features & CPUID_EXT3_SKINIT)) || !s->pe) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { gen_helper_stgi(cpu_env); break; case 5: if (!(s->flags & HF_SVME_MASK) || !s->pe) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { gen_helper_clgi(cpu_env); break; case 6: if ((!(s->flags & HF_SVME_MASK) && !(s->cpuid_ext3_features & CPUID_EXT3_SKINIT)) || !s->pe) gen_helper_skinit(cpu_env); break; case 7: if (!(s->flags & HF_SVME_MASK) || !s->pe) if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); break; } else { gen_helper_invlpga(cpu_env, tcg_const_i32(s->aflag)); break; default: } else if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_svm_check_intercept(s, pc_start, op==2 ? SVM_EXIT_GDTR_WRITE : SVM_EXIT_IDTR_WRITE); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0(OT_WORD + s->mem_index); gen_add_A0_im(s, 2); gen_op_ld_T0_A0(CODE64(s) + OT_LONG + s->mem_index); if (!s->dflag) gen_op_andl_T0_im(0xffffff); if (op == 2) { tcg_gen_st_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,gdt.base)); tcg_gen_st32_tl(cpu_T[1], cpu_env, offsetof(CPUX86State,gdt.limit)); } else { tcg_gen_st_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,idt.base)); tcg_gen_st32_tl(cpu_T[1], cpu_env, offsetof(CPUX86State,idt.limit)); break; case 4: gen_svm_check_intercept(s, pc_start, SVM_EXIT_READ_CR0); #if defined TARGET_X86_64 && defined HOST_WORDS_BIGENDIAN tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]) + 4); #else tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0])); #endif gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 1); break; case 6: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_svm_check_intercept(s, pc_start, SVM_EXIT_WRITE_CR0); gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 0); gen_helper_lmsw(cpu_env, cpu_T[0]); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 7: if (mod != 3) { if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_helper_invlpg(cpu_env, cpu_A0); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); } else { switch (rm) { case 0: #ifdef TARGET_X86_64 if (CODE64(s)) { if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { tcg_gen_ld_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,segs[R_GS].base)); tcg_gen_ld_tl(cpu_T[1], cpu_env, offsetof(CPUX86State,kernelgsbase)); tcg_gen_st_tl(cpu_T[1], cpu_env, offsetof(CPUX86State,segs[R_GS].base)); tcg_gen_st_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,kernelgsbase)); } else #endif { break; case 1: if (!(s->cpuid_ext2_features & CPUID_EXT2_RDTSCP)) gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); if (use_icount) gen_io_start(); gen_helper_rdtscp(cpu_env); if (use_icount) { gen_io_end(); gen_jmp(s, s->pc - s->cs_base); break; default: break; default: break; case 0x108: case 0x109: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_svm_check_intercept(s, pc_start, (b & 2) ? SVM_EXIT_INVD : SVM_EXIT_WBINVD); break; case 0x63: #ifdef TARGET_X86_64 if (CODE64(s)) { int d_ot; d_ot = dflag + OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; rm = (modrm & 7) | REX_B(s); if (mod == 3) { gen_op_mov_TN_reg(OT_LONG, 0, rm); if (d_ot == OT_QUAD) tcg_gen_ext32s_tl(cpu_T[0], cpu_T[0]); gen_op_mov_reg_T0(d_ot, reg); } else { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); if (d_ot == OT_QUAD) { gen_op_lds_T0_A0(OT_LONG + s->mem_index); } else { gen_op_ld_T0_A0(OT_LONG + s->mem_index); gen_op_mov_reg_T0(d_ot, reg); } else #endif { int label1; TCGv t0, t1, t2, a0; if (!s->pe || s->vm86) t0 = tcg_temp_local_new(); t1 = tcg_temp_local_new(); t2 = tcg_temp_local_new(); ot = OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_op_ld_v(ot + s->mem_index, t0, cpu_A0); a0 = tcg_temp_local_new(); tcg_gen_mov_tl(a0, cpu_A0); } else { gen_op_mov_v_reg(ot, t0, rm); TCGV_UNUSED(a0); gen_op_mov_v_reg(ot, t1, reg); tcg_gen_andi_tl(cpu_tmp0, t0, 3); tcg_gen_andi_tl(t1, t1, 3); tcg_gen_movi_tl(t2, 0); label1 = gen_new_label(); tcg_gen_brcond_tl(TCG_COND_GE, cpu_tmp0, t1, label1); tcg_gen_andi_tl(t0, t0, ~3); tcg_gen_or_tl(t0, t0, t1); tcg_gen_movi_tl(t2, CC_Z); gen_set_label(label1); if (mod != 3) { gen_op_st_v(ot + s->mem_index, t0, a0); tcg_temp_free(a0); } else { gen_op_mov_reg_v(ot, rm, t0); gen_compute_eflags(s); tcg_gen_andi_tl(cpu_cc_src, cpu_cc_src, ~CC_Z); tcg_gen_or_tl(cpu_cc_src, cpu_cc_src, t2); tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); break; case 0x102: case 0x103: { int label1; TCGv t0; if (!s->pe || s->vm86) ot = dflag ? OT_LONG : OT_WORD; modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; gen_ldst_modrm(env, s, modrm, OT_WORD, OR_TMP0, 0); t0 = tcg_temp_local_new(); gen_update_cc_op(s); if (b == 0x102) { gen_helper_lar(t0, cpu_env, cpu_T[0]); } else { gen_helper_lsl(t0, cpu_env, cpu_T[0]); tcg_gen_andi_tl(cpu_tmp0, cpu_cc_src, CC_Z); label1 = gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_tmp0, 0, label1); gen_op_mov_reg_v(ot, reg, t0); gen_set_label(label1); set_cc_op(s, CC_OP_EFLAGS); tcg_temp_free(t0); break; case 0x118: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; op = (modrm >> 3) & 7; switch(op) { case 0: case 1: case 2: case 3: if (mod == 3) gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); break; default: gen_nop_modrm(env, s, modrm); break; break; case 0x119 ... 0x11f: modrm = cpu_ldub_code(env, s->pc++); gen_nop_modrm(env, s, modrm); break; case 0x120: case 0x122: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { modrm = cpu_ldub_code(env, s->pc++); rm = (modrm & 7) | REX_B(s); reg = ((modrm >> 3) & 7) | rex_r; if (CODE64(s)) ot = OT_QUAD; else ot = OT_LONG; if ((prefixes & PREFIX_LOCK) && (reg == 0) && (s->cpuid_ext3_features & CPUID_EXT3_CR8LEG)) { reg = 8; switch(reg) { case 0: case 2: case 3: case 4: case 8: gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); if (b & 2) { gen_op_mov_TN_reg(ot, 0, rm); gen_helper_write_crN(cpu_env, tcg_const_i32(reg), cpu_T[0]); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); } else { gen_helper_read_crN(cpu_T[0], cpu_env, tcg_const_i32(reg)); gen_op_mov_reg_T0(ot, rm); break; default: break; case 0x121: case 0x123: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { modrm = cpu_ldub_code(env, s->pc++); rm = (modrm & 7) | REX_B(s); reg = ((modrm >> 3) & 7) | rex_r; if (CODE64(s)) ot = OT_QUAD; else ot = OT_LONG; if (reg == 4 || reg == 5 || reg >= 8) if (b & 2) { gen_svm_check_intercept(s, pc_start, SVM_EXIT_WRITE_DR0 + reg); gen_op_mov_TN_reg(ot, 0, rm); gen_helper_movl_drN_T0(cpu_env, tcg_const_i32(reg), cpu_T[0]); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); } else { gen_svm_check_intercept(s, pc_start, SVM_EXIT_READ_DR0 + reg); tcg_gen_ld_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,dr[reg])); gen_op_mov_reg_T0(ot, rm); break; case 0x106: if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); } else { gen_svm_check_intercept(s, pc_start, SVM_EXIT_WRITE_CR0); gen_helper_clts(cpu_env); gen_jmp_im(s->pc - s->cs_base); gen_eob(s); break; case 0x1c3: if (!(s->cpuid_features & CPUID_SSE2)) ot = s->dflag == 2 ? OT_QUAD : OT_LONG; modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; if (mod == 3) reg = ((modrm >> 3) & 7) | rex_r; gen_ldst_modrm(env, s, modrm, ot, reg, 1); break; case 0x1ae: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; op = (modrm >> 3) & 7; switch(op) { case 0: if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) || (s->prefix & PREFIX_LOCK)) if ((s->flags & HF_EM_MASK) || (s->flags & HF_TS_MASK)) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); break; gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fxsave(cpu_env, cpu_A0, tcg_const_i32((s->dflag == 2))); break; case 1: if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) || (s->prefix & PREFIX_LOCK)) if ((s->flags & HF_EM_MASK) || (s->flags & HF_TS_MASK)) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); break; gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_fxrstor(cpu_env, cpu_A0, tcg_const_i32((s->dflag == 2))); break; case 2: case 3: if (s->flags & HF_TS_MASK) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); break; if ((s->flags & HF_EM_MASK) || !(s->flags & HF_OSFXSR_MASK) || mod == 3) gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); if (op == 2) { gen_op_ld_T0_A0(OT_LONG + s->mem_index); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]); gen_helper_ldmxcsr(cpu_env, cpu_tmp2_i32); } else { tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State, mxcsr)); gen_op_st_T0_A0(OT_LONG + s->mem_index); break; case 5: case 6: if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE2)) break; case 7: if ((modrm & 0xc7) == 0xc0) { if (!(s->cpuid_features & CPUID_SSE)) } else { if (!(s->cpuid_features & CPUID_CLFLUSH)) gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); break; default: break; case 0x10d: modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; if (mod == 3) gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); break; case 0x1aa: gen_svm_check_intercept(s, pc_start, SVM_EXIT_RSM); if (!(s->flags & HF_SMM_MASK)) gen_update_cc_op(s); gen_jmp_im(s->pc - s->cs_base); gen_helper_rsm(cpu_env); gen_eob(s); break; case 0x1b8: if ((prefixes & (PREFIX_REPZ | PREFIX_LOCK | PREFIX_REPNZ)) != PREFIX_REPZ) if (!(s->cpuid_ext_features & CPUID_EXT_POPCNT)) modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; if (s->prefix & PREFIX_DATA) ot = OT_WORD; else if (s->dflag != 2) ot = OT_LONG; else ot = OT_QUAD; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_helper_popcnt(cpu_T[0], cpu_env, cpu_T[0], tcg_const_i32(ot)); gen_op_mov_reg_T0(ot, reg); set_cc_op(s, CC_OP_EFLAGS); break; case 0x10e ... 0x10f: s->prefix &= ~(PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA); case 0x110 ... 0x117: case 0x128 ... 0x12f: case 0x138 ... 0x13a: case 0x150 ... 0x179: case 0x17c ... 0x17f: case 0x1c2: case 0x1c4 ... 0x1c6: case 0x1d0 ... 0x1fe: gen_sse(env, s, b, pc_start, rex_r); break; default: if (s->prefix & PREFIX_LOCK) gen_helper_unlock(); return s->pc; illegal_op: if (s->prefix & PREFIX_LOCK) gen_helper_unlock(); gen_exception(s, EXCP06_ILLOP, pc_start - s->cs_base); return s->pc;
1threat
Error "TestEngine with ID 'junit-vintage' failed to discover tests" with Spring Boot 2.2 : <p>I have a simple app using Spring Boot and Junit 5:</p> <ul> <li><p>When using Spring Boot 2.1 (e.g, 2.1.8 or 2.1.12), my unit tests run smoothly</p></li> <li><p>When using Spring Boot 2.2 (e.g., 2.2.2.RELEASE or 2.3.2.RELEASE) my unit tests fail with error message </p></li> </ul> <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project XXX: There are test failures. [ERROR] [ERROR] Please refer to D:\Projets\workspace\XXX\target\surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] There was an error in the forked process [ERROR] TestEngine with ID 'junit-vintage' failed to discover tests [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process [ERROR] TestEngine with ID 'junit-vintage' failed to discover tests [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656) </code></pre> <p>I am using Maven 3.6.1, JDK 1.8, JUnit 5.6.0 and JUnit platform 1.6.0. I exclude the dependency on <code>junit:junit</code> from <code>spring-boot-starter-test</code>, so that I have no JUnit 4 artifacts left in the dependency tree. Note that both Spring Boot 2.2 and 2.3 use <code>maven-surefire-plugin</code> 2.22.2, so my problem does not originate from any regression of the <code>maven-surefire-plugin</code>.</p> <p>Should I stick to Spring Boot <strong>2.1</strong> in order to have my unit test working?</p> <p>Thanks in advance for your help.</p>
0debug
I have a JQuery function that sets active based on hover, I want to automate this to avoid duplication of effort : <p>I have a fairly simple piece of JQuery that hides/unhides an element, based on which of the tabs are hovered over:</p> <p>HTML:</p> <pre><code> &lt;div class="row col-sm-4"&gt; &lt;ul class="text-center"&gt; &lt;li&gt;&lt;p class="chat-provider-tab tab"&gt;Chat Provider&lt;/p&gt;&lt;/li&gt; &lt;li&gt;&lt;p class="operations-tab tab"&gt;Operations&lt;/p&gt;&lt;/li&gt; &lt;li&gt;&lt;p class="proactive-chat-tab tab"&gt;Proactive Chat&lt;/p&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="row col-sm-8"&gt; &lt;p class="chat-provider helptip" style="display: none"&gt;Chat Provider&lt;/p&gt; &lt;p class="operations helptip" style="display: none"&gt;Operations&lt;/p&gt; &lt;p class="proactive-chat helptip" style="display: none"&gt;Proactive Chat&lt;/p&gt; &lt;/div&gt; </code></pre> <p>JQuery:</p> <pre><code>$(".chat-provider-tab").hover( function(){ $(".chat-provider").toggleClass("activetab") }); $(".operations-tab").hover( function(){ $(".operations").toggleClass("activetab") }); $(".proactive-chat-tab").hover( function(){ $(".proactive-chat").toggleClass("activetab") }); </code></pre> <p>I'd like to automate this where possible, and have tried several methods, however haven't been able to replicate the success I'm having with the above method.</p> <p>Thank you, Suxors</p>
0debug
Volley Server error<!DOCTYPE HTML PUBLIC "-//IETF/ : 1. com.android.volley.ServerError 2. I used Volley JSONArray request its directly receive error response
0debug
void kvm_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, uint64_t mcg_status, uint64_t addr, uint64_t misc) { #ifdef KVM_CAP_MCE struct kvm_x86_mce mce = { .bank = bank, .status = status, .mcg_status = mcg_status, .addr = addr, .misc = misc, }; struct kvm_x86_mce_data data = { .env = cenv, .mce = &mce, }; run_on_cpu(cenv, kvm_do_inject_x86_mce, &data); #endif }
1threat
php: how to sort user array with ids in correct order : <p>I am stuck with this, and I can't figure out the solution.</p> <p>I have 2 arrays:</p> <pre><code>$user_names = array(); $user_ids = array(); </code></pre> <p>Which look like this</p> <pre><code>Array ( [0] =&gt; John [1] =&gt; Peter [2] =&gt; Anna ) Array ( [0] =&gt; 67 [1] =&gt; 68 [2] =&gt; 73 ) </code></pre> <p>I wanted to sort this array by $user_names with <strong>sort($user_names)</strong> but when I sort the user names then my user_ids are not matching up..</p> <p>So if I wanted to print "User: John with id: X" after sorting user_names my ids don't match. I am dead stuck with this...</p>
0debug
I am creating an inventory system in Python for my employer, should I store inventory information in an SQLite database? : <p>I have begun creating an inventory system in Python for my employer. I have the frontend GUI mostly complete and have questions about the backend.</p> <p>How should I store the information?</p> <p>The program will be located in a dropbox folder that can be accessed by multiple people at once. Should I use an SQLite database, and upon executing functions such as "add stock", open a connection, execute the change, and close the connection? Will this allow multiple users to have the inventory open at once? Are there better ways to handle this?</p> <p>There won't be a lot of inventory items. Would it be better to use python objects and object methods to store and manipulate the information?</p>
0debug
please provide compiled classes of your project with sonar.java.binaries property| Java : please provide compiled classes of your project with sonar.java.binaries property. Below is my sonar-project.properties file. sonar.projectKey=Hello sonar.projectName=JavaPro sonar.projectVersion=1.0 sonar.java.sources=java sonar.java.binaries=bin/A.jar sonar.java.file.suffixes=java sonar.sourceEncoding=UTF-8
0debug
starting with regexes : <p><em>disclaimer: entirely new to regexes</em></p> <p>I am trying to write a simple regex to validate email strings like this:</p> <pre><code>/^\w+@\w+\.\w{1,4}/.test(emailstring); </code></pre> <p>The above should return false for = a@d.abcde but true for a@d.abcd. I need the extension to be limited to four characters {1,4}. But it always returns true for any length of tld extension. What's wrong in the above expression?</p>
0debug
CSS multiple tables in same page with different IDs : <p>We have two different tables in the same page. different IDs required for another purpose. So we created multiple CSS table elements in the Style . But only the first one is working. If i keep the customers design on top it will be applied , but only one at a time.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#salescss { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%; } #salescss td, #salescss th { border: 1px solid #ddd; padding: 8px; } #salescss tr:nth-child(even){background-color: #f2f2f2;} #salescss tr:hover {background-color: #ddd;} #salescss th { padding-top: 12px; padding-bottom: 12px; text-align: left; background-color: #357EC7; color: white; body {font-family: Arial;} #customers { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%; } #customers td, #customers th { border: 1px solid #ddd; padding: 8px; } #customers tr:nth-child(even){background-color: #f2f2f2;} #customers tr:hover {background-color: #ddd;} #customers th { padding-top: 12px; padding-bottom: 12px; text-align: left; background-color: #357EC7; color: white; body {font-family: Arial;}</code></pre> </div> </div> </p>
0debug
Valid Function Declaration : <p>I have an abstract C++ Question and I'm having an argument with someone about this:</p> <p>Which one of these could be a valid function declaration:</p> <pre><code>int f ( int i=0, int j ); int f (int j, void k); int f (int i, int u=0 ); int f (int * = 0); </code></pre>
0debug
static void chomp6(ChannelData *ctx, int16_t *output, uint8_t val, const uint16_t tab1[], const int16_t *tab2, int tab2_stride, uint32_t numChannels) { int16_t current; current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val]; if ((ctx->previous ^ current) >= 0) { ctx->factor = FFMIN(ctx->factor + 506, 32767); } else { if (ctx->factor - 314 < -32768) ctx->factor = -32767; else ctx->factor -= 314; } current = mace_broken_clip_int16(current + ctx->level); ctx->level = ((current*ctx->factor) >> 15); current >>= 1; output[0] = QT_8S_2_16S(ctx->previous + ctx->prev2 - ((ctx->prev2-current) >> 2)); output[numChannels] = QT_8S_2_16S(ctx->previous + current + ((ctx->prev2-current) >> 2)); ctx->prev2 = ctx->previous; ctx->previous = current; if ((ctx->index += tab1[val] - (ctx->index >> 5)) < 0) ctx->index = 0; }
1threat
How to make egg-like shape with CSS : <p>I am trying to make a shape similar to the one in this picture: <a href="https://i.stack.imgur.com/Uxe1Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uxe1Z.png" alt="enter image description here"></a></p> <p>Attempting to use border-radius to target the top-left and bottom-left corners of my div gets a close effect but am unable to get such a drastic curve. Is there an elegant solution to this? I've looked into clip-path a little but am not sure if that is the approach to take either.</p>
0debug