problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
AngularError Observable : <p>I'm trying to import the Observable class and the interval method and it's giving it to the terminal
<a href="https://i.stack.imgur.com/BOhup.png" rel="nofollow noreferrer">help</a></p>
| 0debug
|
Need to encrypt data sent to browser and decrypt with JavaScript : <p>My project is sending PHI/PII data to the browser and I need to be to prevent someone from seeing it. How would I encrypt with C# and then decrypt with JavaScript? I cannot user CryptoJS as it is not allowed here. Even though the connection is an SSL connection I am being told I need to encrypt the data. Any ideas?</p>
| 0debug
|
How can I have two conditional and two output in a single lambda? : I would like to filter variables below two standard deviations and those above to standarf deviations. I know I can do this with def/ return and then apply statement but was wondering if I could somehow do this in a single line with lambda.
I have tried the code below (the numbers in 'No- show' are all int and were the base from which I calculated the median, upper, and lower two standard deviations):
```df2F['outlier_neighbourhood']=df2F['No-show'].apply(lambda x: 'Lower Outlier' if x <0.6091564238171008 elif 'Upper Outlier' else 'normal')```
I get:
File "<ipython-input-99-551ef7a6f734>", line 2
df2F['outlier_neighbourhood']=df2F['No-show'].apply(lambda x: 'Lower Outlier' if x <0.6091564238171008 elif 'Upper Outlier' else 'normal')
^
SyntaxError: invalid syntax
| 0debug
|
How change django admin "view site" link to custom absolute url : <p>I have REST API built on Django and JS application. Both are on different domains. How to change django admin "view site" link in such way so it will open JS application? I've tried to pass absolute link (<a href="https://docs.djangoproject.com/es/1.10/ref/contrib/admin/#django.contrib.admin.AdminSite.site_url" rel="noreferrer">https://docs.djangoproject.com/es/1.10/ref/contrib/admin/#django.contrib.admin.AdminSite.site_url</a>), but looks like it does not work - only relative paths allowed </p>
| 0debug
|
I have an observation and I need to make a column from it. SAS : I have an observation and I need to make a column from it.
I tried split, I tried transpose, but nothing...
<!-- begin snippet: js hide: true -->
<!-- language: lang-js -->
I have:
num first second third
1 13 17 16
2 23 11 64
I need:
num var_n
1 13
17
16
2 23
11
64
<!-- end snippet -->
Can you give me some advice, please
| 0debug
|
How to fix Unprotected SMS BroadcastReceiver lint warning : <p>My app needs to be able to receive SMS messages. It all works, but I get this lint warning:</p>
<blockquote>
<p>BroadcastReceivers that declare an intent-filter for SMS_DELIVER or
SMS_RECEIVED must ensure that the caller has the BROADCAST_SMS
permission, otherwise it is possible for malicious actors to spoof
intents.</p>
</blockquote>
<p>How do I "ensure that the caller has the BROADCAST_SMS permission"?</p>
<p>In my manifest I have:</p>
<pre><code><uses-permission android:name="android.permission.RECEIVE_SMS" />
<application ...>
<receiver
android:name=".SmsReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
</code></pre>
<p>My code:</p>
<pre><code>public class SmsReceiver extends BroadcastReceiver {
public SmsReceiver() {}
@Override
public void onReceive(final Context context, final Intent intent) {
final Bundle bundle = intent.getExtras();
if (bundle != null) {
final Object[] pdusObj = (Object[]) bundle.get("pdus");
for (int i = 0; i < pdusObj.length; i++) {
final SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]);
// use currentMessage
}
}
}
}
</code></pre>
| 0debug
|
static void usb_msd_realize_storage(USBDevice *dev, Error **errp)
{
MSDState *s = USB_STORAGE_DEV(dev);
BlockBackend *blk = s->conf.blk;
SCSIDevice *scsi_dev;
Error *err = NULL;
if (!blk) {
error_setg(errp, "drive property not set");
return;
}
bdrv_add_key(blk_bs(blk), NULL, &err);
if (err) {
if (monitor_cur_is_qmp()) {
error_propagate(errp, err);
return;
}
error_free(err);
err = NULL;
if (cur_mon) {
monitor_read_bdrv_key_start(cur_mon, blk_bs(blk),
usb_msd_password_cb, s);
s->dev.auto_attach = 0;
} else {
autostart = 0;
}
}
blkconf_serial(&s->conf, &dev->serial);
blkconf_blocksizes(&s->conf);
blk_detach_dev(blk, &s->dev.qdev);
s->conf.blk = NULL;
usb_desc_create_serial(dev);
usb_desc_init(dev);
scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
&usb_msd_scsi_info_storage, NULL);
scsi_dev = scsi_bus_legacy_add_drive(&s->bus, blk, 0, !!s->removable,
s->conf.bootindex, dev->serial,
&err);
if (!scsi_dev) {
error_propagate(errp, err);
return;
}
usb_msd_handle_reset(dev);
s->scsi_dev = scsi_dev;
}
| 1threat
|
How Create Undertow server with async support in java? : <p>I wanted to create embedded server in my jar so, it can run as from command, like executable jar to run web app. </p>
<p>I find that we can embed undertow server, but how to do it.</p>
| 0debug
|
Best way to execute a python script in a given conda environment : <p>I want to execute a python script <code>executed.py</code> from another python script <code>trigger.py</code> using the subprocess package. The <code>executed.py</code> must be ran in a different conda environment than <code>trigger.py</code> (let say <strong><code>executed_env</code></strong> and <strong><code>trigger_env</code></strong>). What is the best way to do that ? My current code of <code>trigger.py</code> is:</p>
<pre><code>command = "python executed.py --option1 -dir /path/to/dir"
args = shlex.split(command)
my_subprocess = subprocess.Popen(args)
</code></pre>
<p>It returns an error since <code>executed.py</code> is ran in the <strong><code>trigger_env</code></strong> environment.</p>
| 0debug
|
static int tls_read(URLContext *h, uint8_t *buf, int size)
{
TLSContext *c = h->priv_data;
size_t processed = 0;
int ret = SSLRead(c->ssl_context, buf, size, &processed);
ret = map_ssl_error(ret, processed);
if (ret > 0)
return ret;
if (ret == 0)
return AVERROR_EOF;
return print_tls_error(h, ret);
}
| 1threat
|
Definition of Undefined behaviour : <p>I have read on <a href="http://en.cppreference.com/w/cpp/language/ub" rel="nofollow noreferrer" title="Undefined Behavior">cppreference</a> about Undefined behavior and understand the differences. What I didn't find though is what is implicit.</p>
<p>I would expect any behavior that is not explicitly defined to be unspecified behavior. But when I tried to find what <code>t</code> means in <code>fopen</code>'s format string, there was nothing in the <a href="http://en.cppreference.com/w/cpp/io/c/fopen" rel="nofollow noreferrer" title="fopen">cppreference</a> on it and nowhere does it state that it is implementation defined. What bugs me even more is that in notes it is explicitly stated about the <code>filename</code> parameter.</p>
<p>On the other hand <a href="https://msdn.microsoft.com/en-us/library/yeby3zcb.aspx" rel="nofollow noreferrer" title="fopen">msdn</a> defines among others the <code>t</code> parameter so that would mean that any behavior not explicitly stated as undefined can be implementation defined? Or is the cppreference just missing a sentence and I'm only chasing ghosts?</p>
<p>I guess what the question boils down for me is, if there is nothing written about something, what is it, undefined or implementation defined behavior?</p>
<p>PS. The question is about general case so please don't tell me how to use <code>fopen</code> "the right way" in the answers. The function was just an example.</p>
| 0debug
|
Errors while seeing vars up to zero in "If-else" : I've got problem with UiTextField.
It shows ,,Expected expression", ,,Expression resolves to an unused property", ,,Consecutive statements on a line must be separated by ';'" errors.
I've implemented the function like this:
if var1 != nil && var2 != nil && var3 != nil {
self.var1.delegate = (self as! UITextFieldDelegate)
self.var2.delegate = (self as! UITextFieldDelegate)
self.var3.delegate = (self as! UITextFieldDelegate)
// Do any additional setup after loading the view.
} else {
var1: Double = 0 // <- errors up here
var2: Double = 0
var3: Double = 0
}
}
If I delate the var1 error goes to the line below.
Thanks for help
| 0debug
|
'names' attribute [343] must be the same length as the vector [0] in plm : I am running a panel regression using 'plm' function using the following code:
test_reg=plm(y~x1+x2+x3+x4*x7+x5*x7+x6*x7+x8+x9+x10+x11,DATA, index = c("year","id"),model ="within")
summary(test_reg)
Then I get the following error:
Error in names(y) <- namesy :
'names' attribute [343] must be the same length as the vector [0]
However, when I switch the y variable and x10 variable and run the same 'plm' function again, I do not get such an error and it works well.
May I ask for help on this?
| 0debug
|
C# I have got NullReferenceException when I was making textbox for finding name in column in DGV : <p>I have problem with textbox finding I have got this piece of program to make "Starts With" method to find it by putting three letters into the textbox and it will find all that matches with three starting letters. Here is the code I have used</p>
<pre><code> private void findTextBox_TextChanged(object sender, EventArgs e)
{
var bd = (BindingSource)debtDGV.DataSource;
var dt = (DataTable)bd.DataSource;
dt.DefaultView.RowFilter = string.Format(" '{0}%'", findTextBox.Text.Trim().Replace("'", "''"));
debtDGV.Refresh();
}
</code></pre>
| 0debug
|
How to change base url only for rest controllers? : <p>Is there any configuration option that allows to change base url only for rest controllers, for example if my api's base url is www.example.com/user/{id} becomes www.example.com/rest/user/{id} ?</p>
<p>I am using spring boot v1.3.2</p>
<p>I tried to create custom annotation which extends RestController by adding RequestMapping.
Here is the example, but it does not work.</p>
<pre><code>@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@RestController
@RequestMapping(value = "/rest", path = "/rest")
public @interface MyRestController { }
</code></pre>
| 0debug
|
static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
{
AVIOContext *pb = s->pb;
APEContext *ape = s->priv_data;
AVStream *st;
uint32_t tag;
int i;
int total_blocks;
int64_t pts;
ape->junklength = 0;
tag = avio_rl32(pb);
if (tag != MKTAG('M', 'A', 'C', ' '))
return -1;
ape->fileversion = avio_rl16(pb);
if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);
return -1;
if (ape->fileversion >= 3980) {
ape->padding1 = avio_rl16(pb);
ape->descriptorlength = avio_rl32(pb);
ape->headerlength = avio_rl32(pb);
ape->seektablelength = avio_rl32(pb);
ape->wavheaderlength = avio_rl32(pb);
ape->audiodatalength = avio_rl32(pb);
ape->audiodatalength_high = avio_rl32(pb);
ape->wavtaillength = avio_rl32(pb);
avio_read(pb, ape->md5, 16);
if (ape->descriptorlength > 52)
avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR);
ape->compressiontype = avio_rl16(pb);
ape->formatflags = avio_rl16(pb);
ape->blocksperframe = avio_rl32(pb);
ape->finalframeblocks = avio_rl32(pb);
ape->totalframes = avio_rl32(pb);
ape->bps = avio_rl16(pb);
ape->channels = avio_rl16(pb);
ape->samplerate = avio_rl32(pb);
} else {
ape->descriptorlength = 0;
ape->headerlength = 32;
ape->compressiontype = avio_rl16(pb);
ape->formatflags = avio_rl16(pb);
ape->channels = avio_rl16(pb);
ape->samplerate = avio_rl32(pb);
ape->wavheaderlength = avio_rl32(pb);
ape->wavtaillength = avio_rl32(pb);
ape->totalframes = avio_rl32(pb);
ape->finalframeblocks = avio_rl32(pb);
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
avio_seek(pb, 4, SEEK_CUR);
ape->headerlength += 4;
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
ape->seektablelength = avio_rl32(pb);
ape->headerlength += 4;
ape->seektablelength *= sizeof(int32_t);
} else
ape->seektablelength = ape->totalframes * sizeof(int32_t);
if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT)
ape->bps = 8;
else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT)
ape->bps = 24;
else
ape->bps = 16;
if (ape->fileversion >= 3950)
ape->blocksperframe = 73728 * 4;
else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800 && ape->compressiontype >= 4000))
ape->blocksperframe = 73728;
else
ape->blocksperframe = 9216;
if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
avio_seek(pb, ape->wavheaderlength, SEEK_CUR);
if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
return -1;
ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame));
if(!ape->frames)
return AVERROR(ENOMEM);
ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength;
ape->currentframe = 0;
ape->totalsamples = ape->finalframeblocks;
if (ape->totalframes > 1)
ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1);
if (ape->seektablelength > 0) {
ape->seektable = av_malloc(ape->seektablelength);
for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
ape->seektable[i] = avio_rl32(pb);
ape->frames[0].pos = ape->firstframe;
ape->frames[0].nblocks = ape->blocksperframe;
ape->frames[0].skip = 0;
for (i = 1; i < ape->totalframes; i++) {
ape->frames[i].pos = ape->seektable[i];
ape->frames[i].nblocks = ape->blocksperframe;
ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos;
ape->frames[i].skip = (ape->frames[i].pos - ape->frames[0].pos) & 3;
ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4;
ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks;
for (i = 0; i < ape->totalframes; i++) {
if(ape->frames[i].skip){
ape->frames[i].pos -= ape->frames[i].skip;
ape->frames[i].size += ape->frames[i].skip;
ape->frames[i].size = (ape->frames[i].size + 3) & ~3;
ape_dumpinfo(s, ape);
if (!url_is_streamed(pb)) {
ff_ape_parse_tag(s);
avio_seek(pb, 0, SEEK_SET);
av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype);
st = av_new_stream(s, 0);
if (!st)
return -1;
total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_APE;
st->codec->codec_tag = MKTAG('A', 'P', 'E', ' ');
st->codec->channels = ape->channels;
st->codec->sample_rate = ape->samplerate;
st->codec->bits_per_coded_sample = ape->bps;
st->codec->frame_size = MAC_SUBFRAME_SIZE;
st->nb_frames = ape->totalframes;
st->start_time = 0;
st->duration = total_blocks / MAC_SUBFRAME_SIZE;
av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate);
st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);
st->codec->extradata_size = APE_EXTRADATA_SIZE;
AV_WL16(st->codec->extradata + 0, ape->fileversion);
AV_WL16(st->codec->extradata + 2, ape->compressiontype);
AV_WL16(st->codec->extradata + 4, ape->formatflags);
pts = 0;
for (i = 0; i < ape->totalframes; i++) {
ape->frames[i].pts = pts;
av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME);
pts += ape->blocksperframe / MAC_SUBFRAME_SIZE;
return 0;
| 1threat
|
Just want to print out 2 values from an API response Python : <p>I am calling an API that returns some user data, see output below.</p>
<p>All I want to do is print out 2 of the values from each section labeled node, ultimately I want to use the output in an html table. I have looked at a dozen or more posts on here and can't get this sort of output.</p>
<p>In the case out the output below I would like to print out 2 lines:
<code>username 1 - email address 1</code></p>
<p><code>username 2 - email address 2</code></p>
<pre><code>{
"data": {
"organization": {
"samlIdentityProvider": {
"externalIdentities": {
"edges": [
{
"node": {
"guid": "SOMESTRING 1",
"samlIdentity": {
"nameId": "email address 1"
},
"user": {
"login": "username 1"
}
}
},
{
"node": {
"guid": "SOMESTRING 2",
"samlIdentity": {
"nameId": "email address 2"
},
"user": {
"login": "username 2"
}
}
}
]
},
"ssoUrl": "https://ssomeurl.com"
}
}
}
}
</code></pre>
| 0debug
|
static void coroutine_fn backup_run(void *opaque)
{
BackupBlockJob *job = opaque;
BackupCompleteData *data;
BlockDriverState *bs = job->common.bs;
BlockDriverState *target = job->target;
BlockdevOnError on_target_error = job->on_target_error;
NotifierWithReturn before_write = {
.notify = backup_before_write_notify,
};
int64_t start, end;
int64_t sectors_per_cluster = cluster_size_sectors(job);
int ret = 0;
QLIST_INIT(&job->inflight_reqs);
qemu_co_rwlock_init(&job->flush_rwlock);
start = 0;
end = DIV_ROUND_UP(job->common.len, job->cluster_size);
job->bitmap = hbitmap_alloc(end, 0);
bdrv_set_enable_write_cache(target, true);
if (target->blk) {
blk_set_on_error(target->blk, on_target_error, on_target_error);
blk_iostatus_enable(target->blk);
}
bdrv_add_before_write_notifier(bs, &before_write);
if (job->sync_mode == MIRROR_SYNC_MODE_NONE) {
while (!block_job_is_cancelled(&job->common)) {
job->common.busy = false;
qemu_coroutine_yield();
job->common.busy = true;
}
} else if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
ret = backup_run_incremental(job);
} else {
for (; start < end; start++) {
bool error_is_read;
if (yield_and_check(job)) {
break;
}
if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
int i, n;
int alloced = 0;
for (i = 0; i < sectors_per_cluster;) {
alloced =
bdrv_is_allocated(bs,
start * sectors_per_cluster + i,
sectors_per_cluster - i, &n);
i += n;
if (alloced == 1 || n == 0) {
break;
}
}
if (alloced == 0) {
continue;
}
}
ret = backup_do_cow(bs, start * sectors_per_cluster,
sectors_per_cluster, &error_is_read, false);
if (ret < 0) {
BlockErrorAction action =
backup_error_action(job, error_is_read, -ret);
if (action == BLOCK_ERROR_ACTION_REPORT) {
break;
} else {
start--;
continue;
}
}
}
}
notifier_with_return_remove(&before_write);
qemu_co_rwlock_wrlock(&job->flush_rwlock);
qemu_co_rwlock_unlock(&job->flush_rwlock);
hbitmap_free(job->bitmap);
if (target->blk) {
blk_iostatus_disable(target->blk);
}
bdrv_op_unblock_all(target, job->common.blocker);
data = g_malloc(sizeof(*data));
data->ret = ret;
block_job_defer_to_main_loop(&job->common, backup_complete, data);
}
| 1threat
|
JSON Parsing to multiple TextView : <p>I have problem with parsing my JSON Object to multiple textview.</p>
<p>I have a TextView1, TextView2 and TextView3.</p>
<p>I would like to download data from: "max", "min" and "average" and synch data with .settext in TextView1, TextView2 and TextView3</p>
<p>My JSON looks: <em>{"max":15.6,"min":14.05,"average":14.55}</em></p>
<p>My code below:</p>
<pre><code>public class JSONTask extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
HttpURLConnection connection = null;
BufferedReader reader = null;
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
Log.d("Login attempt", connection.toString());
InputStream stream = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(stream));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
String finalJson = buffer.toString();
JSONObject parentObject = new JSONObject(finalJson);
String maxPrice = parentObject.getString("max");
return maxPrice;
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.disconnect();
}
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
</code></pre>
<p>onPostExecute:</p>
<pre><code>protected void onPostExecute (String result){
super.onPostExecute(result);
maxPrice.setText(result);
</code></pre>
<p>I can't add more String and synch in other TextView. That's work only for one TextView. I can't synch multiple TextView. Can you help me?</p>
| 0debug
|
java.lang.ArrayIndexOutOfBoundsException 2 out of 2 : <p>Can you please help I am new to proggraming and I don not even no what this error is caused from here is my code. I am trying to make a working Resistence formula but its not working.</p>
<pre><code> int n=kb.nextInt();
double massiv[]=new double[n];
for(int i=0;i<=massiv.length;i++){
massiv[i]=kb.nextDouble();
}
for(int i=0;i<=massiv.length;i++){
gr=massiv[i]*gr;
dr=massiv[i]+dr;
}
Re=gr/dr;
System.out.println(+Re);
</code></pre>
| 0debug
|
What's the difference between UIWebView and WKWebView when loading local resources : <p>I want to load local resources with webView. I built a demo with both UIWebView and WKWebView to do some test with the code below.</p>
<pre><code> let uiWebView = UIWebView(frame: self.view.bounds)
self.view.addSubview(uiWebView)
let wkWebView = WKWebView(frame:CGRect(x: 0, y: 400, width: 500, height: 500))
self.view.addSubview(wkWebView)
let path = Bundle.main.path(forResource:"1", ofType: "png")
guard let realPath = path else {
return
}
let url = URL(string: realPath)
let fileUrl = URL(fileURLWithPath: realPath)
if let realUrl = url {
uiWebView.loadRequest(URLRequest(url:realUrl))
wkWebView.load(URLRequest(url:realUrl))
}
// uiWebView.loadRequest(URLRequest(url:fileUrl))
// wkWebView.load(URLRequest(url:fileUrl))
</code></pre>
<p>The uiWebView can load the resource but wkWebView can not. But if I use</p>
<pre><code> uiWebView.loadRequest(URLRequest(url:fileUrl))
wkWebView.load(URLRequest(url:fileUrl))
</code></pre>
<p>both uiWebView and wkWebView can work well.
I am confused and can anyone explain that for me:
Shouldn't I use URL(string: realPath) for a local resource? But why UIWebView can use it ? </p>
| 0debug
|
I need help, and excel VBA isnt helping me figure out anything. : my code ran fine without the things post the content part, i need to output a text file with the object name and the text inside of it. if one of you geniuses could figure out how to have it be .CSV i would absolutely adore it, but a .txt works for my purposes. the error i am getting says that it is out of the range, and i have no idea how to move forward. so any help works.
Sub test()
Dim objFSO As Object, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Users\[user]\Documents\text.txt", 2)
objFile.Write "" 'This clears the text file
Dim obj As Shape
For Each obj In ActiveSheet.Shapes
sWrite = obj.Name & "; Content: " & obj.TextFrame2.TextRange.Characters(0, 300)
Debug.Print sWrite
objFile.WriteLine sWrite
Next obj
objFile.Close
End Sub
| 0debug
|
static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
uint8_t (*layout_map)[3],
GetBitContext *gb, int byte_align_ref)
{
int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc;
int sampling_index;
int comment_len;
int tags;
skip_bits(gb, 2);
sampling_index = get_bits(gb, 4);
if (m4ac->sampling_index != sampling_index)
av_log(avctx, AV_LOG_WARNING,
"Sample rate index in program config element does not "
"match the sample rate index configured by the container.\n");
num_front = get_bits(gb, 4);
num_side = get_bits(gb, 4);
num_back = get_bits(gb, 4);
num_lfe = get_bits(gb, 2);
num_assoc_data = get_bits(gb, 3);
num_cc = get_bits(gb, 4);
if (get_bits1(gb))
skip_bits(gb, 4);
if (get_bits1(gb))
skip_bits(gb, 4);
if (get_bits1(gb))
skip_bits(gb, 3);
if (get_bits_left(gb) < 4 * (num_front + num_side + num_back + num_lfe + num_assoc_data + num_cc)) {
av_log(avctx, AV_LOG_ERROR, "decode_pce: " overread_err);
return -1;
}
decode_channel_map(layout_map , AAC_CHANNEL_FRONT, gb, num_front);
tags = num_front;
decode_channel_map(layout_map + tags, AAC_CHANNEL_SIDE, gb, num_side);
tags += num_side;
decode_channel_map(layout_map + tags, AAC_CHANNEL_BACK, gb, num_back);
tags += num_back;
decode_channel_map(layout_map + tags, AAC_CHANNEL_LFE, gb, num_lfe);
tags += num_lfe;
skip_bits_long(gb, 4 * num_assoc_data);
decode_channel_map(layout_map + tags, AAC_CHANNEL_CC, gb, num_cc);
tags += num_cc;
relative_align_get_bits(gb, byte_align_ref);
comment_len = get_bits(gb, 8) * 8;
if (get_bits_left(gb) < comment_len) {
av_log(avctx, AV_LOG_ERROR, "decode_pce: " overread_err);
return AVERROR_INVALIDDATA;
}
skip_bits_long(gb, comment_len);
return tags;
}
| 1threat
|
Clicking one button then active another button : I want clicking 1st button then active 2nd button, when active 2nd button then disable 1st button. i write below this code but this code is not working. where is the problem?
<!DOCTYPE html>
<html>
<head>
<title>Edit Page</title>
</head>
<body>
<input type="submit" name="submit" value="button1" id="bt1">
<input type="button" name="button" value="button2" id="bt2" disabled="disabled">
</body>
<script>
$(function(){
$("#bt1").click(function(){
$(this).attr("disabled", "disabled");
$("#bt2").removeAttr("disabled");
});
$("#bt2").click(function(){
$(this).attr("disabled", "disabled");
$("#bt1").removeAttr("disabled");
});
});
</script>
</html>
| 0debug
|
Convert string into link javascript object : I have an object which have a property with a value of string.
var notificationDetails = {
dangerMessage: "I love basketball and love to watch it in. <a href='www.nba.com'>Link</a>;",
seats: "1 seatRemaining",
pName: "Item 1",
class:""
};
document.write(notificationDetails.dangerMessage);
How can I convert the a element to a link in the dangerMessage property, it reads as string not the actual link. Thank you in advance.
| 0debug
|
how can i defined meta tags for related post thumbnails in tumblr? : <p>I am using shareaholic but problem is that all related post thumbnails are picking profile picture image instead of post images. Now all thumbnail images are showing same image i want different image for every thumbnail. How can i defined meta tags in head section of my tumblr theme? I tried some but i'm not successful because I have little knowledge of html and meta tags. </p>
| 0debug
|
What does the term pass mean in python? : <p>What does pass mean in python? I have seen it used and I do not see why you need to use it or what it does? I guess I could say it passes over whatever function it is in, but why include it?</p>
| 0debug
|
Python Django Syntax error : <p>I am New to python and I am learning Django right now by following online tutorials
I installed python and check by getversion command in python shell
so, I started to work on the First project, The problem in this project I am facing is when I run the command in command prompt it gives the output but in python shell it's not working it's giving syntax error, Here below I mentioned the command and error I am facing in my first app, Please review it and guide me
I typed the following command in Shell and Prompt of Python
django admin startproject mysite</p>
<p>It gives the following Error
Invalid Syntax </p>
<p>Before executing this I run this in command prompt, by cd: comment I changed my directory, for example, i changed my directory to desktop and give the command " django admin startproject mysite"
and execute the command and view the result in localhost</p>
<p>My issue is why it's not getting in python shell</p>
| 0debug
|
static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s)
{
AVIOContext *pb;
WtvFile *wf;
uint8_t *buffer;
if (avio_seek(s->pb, (int64_t)first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0)
return NULL;
wf = av_mallocz(sizeof(WtvFile));
if (!wf)
return NULL;
if (depth == 0) {
wf->sectors = av_malloc(sizeof(uint32_t));
if (!wf->sectors) {
av_free(wf);
return NULL;
}
wf->sectors[0] = first_sector;
wf->nb_sectors = 1;
} else if (depth == 1) {
wf->sectors = av_malloc(WTV_SECTOR_SIZE);
if (!wf->sectors) {
av_free(wf);
return NULL;
}
wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4);
} else if (depth == 2) {
uint32_t sectors1[WTV_SECTOR_SIZE / 4];
int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);
int i;
wf->sectors = av_malloc(nb_sectors1 << WTV_SECTOR_BITS);
if (!wf->sectors) {
av_free(wf);
return NULL;
}
wf->nb_sectors = 0;
for (i = 0; i < nb_sectors1; i++) {
if (avio_seek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)
break;
wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4);
}
} else {
av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth);
av_free(wf);
return NULL;
}
wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS;
if (!wf->nb_sectors) {
av_free(wf->sectors);
av_free(wf);
return NULL;
}
if (wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb))
av_log(s, AV_LOG_WARNING, "truncated file\n");
length &= 0xFFFFFFFFFFFF;
if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) {
av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits);
length = (int64_t)wf->nb_sectors << wf->sector_bits;
}
wf->length = length;
wf->position = 0;
if (avio_seek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) {
av_free(wf->sectors);
av_free(wf);
return NULL;
}
wf->pb_filesystem = s->pb;
buffer = av_malloc(1 << wf->sector_bits);
if (!buffer) {
av_free(wf->sectors);
av_free(wf);
return NULL;
}
pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf,
wtvfile_read_packet, NULL, wtvfile_seek);
if (!pb) {
av_free(buffer);
av_free(wf->sectors);
av_free(wf);
}
return pb;
}
| 1threat
|
static int send_response(GAState *s, QObject *payload)
{
const char *buf;
QString *payload_qstr;
GIOStatus status;
g_assert(payload && s->channel);
payload_qstr = qobject_to_json(payload);
if (!payload_qstr) {
return -EINVAL;
}
qstring_append_chr(payload_qstr, '\n');
buf = qstring_get_str(payload_qstr);
status = ga_channel_write_all(s->channel, buf, strlen(buf));
QDECREF(payload_qstr);
if (status != G_IO_STATUS_NORMAL) {
return -EIO;
}
return 0;
}
| 1threat
|
def is_Sum_Of_Powers_Of_Two(n):
if (n % 2 == 1):
return False
else:
return True
| 0debug
|
Mongoose use only createdAt timestamp : <p>I have the following message schema in mongoose:</p>
<pre><code>var messageSchema = mongoose.Schema({
userID: { type: ObjectId, required: true, ref: 'User' },
text: { type: String, required: true }
},
{
timestamps: true
});
</code></pre>
<p>Is there anyway to ignore the updatedAt timestamp? Messages won't be updated so updatedAt will be wasted space</p>
| 0debug
|
static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
{
int i, v, j;
dprintf("matrix extension\n");
if (get_bits1(&s->gb)) {
for(i=0;i<64;i++) {
v = get_bits(&s->gb, 8);
j = zigzag_direct[i];
s->intra_matrix[j] = v;
s->chroma_intra_matrix[j] = v;
}
}
if (get_bits1(&s->gb)) {
for(i=0;i<64;i++) {
v = get_bits(&s->gb, 8);
j = zigzag_direct[i];
s->non_intra_matrix[j] = v;
s->chroma_non_intra_matrix[j] = v;
}
}
if (get_bits1(&s->gb)) {
for(i=0;i<64;i++) {
v = get_bits(&s->gb, 8);
j = zigzag_direct[i];
s->chroma_intra_matrix[j] = v;
}
}
if (get_bits1(&s->gb)) {
for(i=0;i<64;i++) {
v = get_bits(&s->gb, 8);
j = zigzag_direct[i];
s->chroma_non_intra_matrix[j] = v;
}
}
}
| 1threat
|
static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,
int64_t offset, unsigned int bytes, QEMUIOVector *qiov, int flags)
{
BlockDriver *drv = bs->drv;
BdrvTrackedRequest req;
int ret;
int64_t sector_num = offset >> BDRV_SECTOR_BITS;
unsigned int nb_sectors = bytes >> BDRV_SECTOR_BITS;
assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
if (bs->copy_on_read_in_flight) {
wait_for_overlapping_requests(bs, offset, bytes);
}
tracked_request_begin(&req, bs, offset, bytes, true);
ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req);
if (ret < 0) {
} else if (flags & BDRV_REQ_ZERO_WRITE) {
ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags);
} else {
ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
}
if (ret == 0 && !bs->enable_write_cache) {
ret = bdrv_co_flush(bs);
}
bdrv_set_dirty(bs, sector_num, nb_sectors);
if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {
bs->wr_highest_sector = sector_num + nb_sectors - 1;
}
if (bs->growable && ret >= 0) {
bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors);
}
tracked_request_end(&req);
return ret;
}
| 1threat
|
static void megasas_mmio_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
MegasasState *s = opaque;
uint64_t frame_addr;
uint32_t frame_count;
int i;
trace_megasas_mmio_writel(addr, val);
switch (addr) {
case MFI_IDB:
if (val & MFI_FWINIT_ABORT) {
for (i = 0; i < s->fw_cmds; i++) {
megasas_abort_command(&s->frames[i]);
}
}
if (val & MFI_FWINIT_READY) {
megasas_soft_reset(s);
}
if (val & MFI_FWINIT_MFIMODE) {
}
break;
case MFI_OMSK:
s->intr_mask = val;
if (!megasas_intr_enabled(s) && !msix_enabled(&s->dev)) {
trace_megasas_irq_lower();
qemu_irq_lower(s->dev.irq[0]);
}
if (megasas_intr_enabled(s)) {
trace_megasas_intr_enabled();
} else {
trace_megasas_intr_disabled();
}
break;
case MFI_ODCR0:
s->doorbell = 0;
if (s->producer_pa && megasas_intr_enabled(s)) {
trace_megasas_qf_update(s->reply_queue_head, s->busy);
stl_le_phys(s->producer_pa, s->reply_queue_head);
if (!msix_enabled(&s->dev)) {
trace_megasas_irq_lower();
qemu_irq_lower(s->dev.irq[0]);
}
}
break;
case MFI_IQPH:
s->frame_hi = val;
break;
case MFI_IQPL:
case MFI_IQP:
frame_addr = (val & ~0x1F);
frame_addr |= ((uint64_t)s->frame_hi << 32);
s->frame_hi = 0;
frame_count = (val >> 1) & 0xF;
megasas_handle_frame(s, frame_addr, frame_count);
break;
default:
trace_megasas_mmio_invalid_writel(addr, val);
break;
}
}
| 1threat
|
Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis : <p>I've started using the latest beta of v2 of chart.js since I need to draw a chart that contains both a stacked bar chart and an unstacked line chart on the same chart. Here's an example of what I need:</p>
<p><a href="https://i.stack.imgur.com/Blcid.jpg"><img src="https://i.stack.imgur.com/Blcid.jpg" alt="enter image description here"></a></p>
<p>In this chart the lines are not stacked and are all showing their natural values but the bar chart is stacked and shows the combined total of the values (including some negative values).</p>
<p>I've managed to get the two charts drawn together but so far I've only succeeded in either having both charts stacked or I've had to use two separate y-axis which ends up with 2 scales. There's an example of the separate y-axis in this <a href="https://jsfiddle.net/jptabubm/">fiddle</a>:</p>
<pre><code>yAxes: [{
stacked: false,
ticks: {
beginAtZero: true
}
}, {
id: "bar-y-axis",
stacked: true,
ticks: {
beginAtZero: true
},
type: 'linear'
}]
</code></pre>
<p>If I remove the first y-axis then I ended up with a single scale with the only problem being that the line chart is now stacked as well.</p>
<p>Is there any way to draw a chart like I need using chart.js?</p>
| 0debug
|
Error java.lang.ArrayIndexOutOfBoundsException:2 : <p>I am facing java.lang.ArrayIndexOutOfBoundsException.... But my String includes more than 2 values </p>
<pre><code> String[] elements = { "Allama Iqbal","born","in","Sailkot"};
String str = String.join(",", elements);
String str = String.join(",", elements);
String[] strArray = new String[] {str};
if(strArray[2].equals("NNP") ) {
}
The POS are...Allama//NNP
The POS are...Iqbal//NNP
The POS are...,//,
The POS are...born//VBN
The POS are...,//,
The POS are...in//IN
The POS are...,//,
The POS are...Sailkot//NNP
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
</code></pre>
| 0debug
|
rgb16_32ToUV_c_template(uint8_t *dstU, uint8_t *dstV,
const uint8_t *src, int width,
enum PixelFormat origin,
int shr, int shg, int shb, int shp,
int maskr, int maskg, int maskb,
int rsh, int gsh, int bsh, int S)
{
const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
rv = RV << rsh, gv = GV << gsh, bv = BV << bsh,
rnd = 257 << (S - 1);
int i;
for (i = 0; i < width; i++) {
int px = input_pixel(i) >> shp;
int b = (px & maskb) >> shb;
int g = (px & maskg) >> shg;
int r = (px & maskr) >> shr;
dstU[i] = (ru * r + gu * g + bu * b + rnd) >> S;
dstV[i] = (rv * r + gv * g + bv * b + rnd) >> S;
}
}
| 1threat
|
How to count number of spaces just after the date information? : <p>I have unstructured data that look like this:</p>
<pre><code>data <- c("24-March-2017 product 1 color 1",
"March-2017-24 product 2 color 2",
"2017-24-March product 3 color 3")
</code></pre>
<p>I would like to count number of spaces between the date and the first character (product column) for each line. As shown in the sample data, the date format can vary. This information will be used to put the data into structured format.</p>
<p>What is the best way to perform this in R? I believe <code>gsub</code> can be used in this case, just not sure how to apply to count only number of spaces at the beginning of each line.</p>
| 0debug
|
I am trying to insert value directly to double pointer matrix as follows : <pre><code>int **matrix = {{1,2,3,4},{1,2,3,4},{1,2,3,4},{1,2,3,4}};
int vertices = 4;
matrix = malloc(vertices * sizeof (int *));
</code></pre>
<p>so when I print the matrix, it is displaying garbage values.</p>
| 0debug
|
static int ws_snd_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int in_size, out_size;
int sample = 128;
int i;
uint8_t *samples = data;
uint8_t *samples_end;
if (!buf_size)
return 0;
if (buf_size < 4) {
av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
out_size = AV_RL16(&buf[0]);
in_size = AV_RL16(&buf[2]);
buf += 4;
if (out_size > *data_size) {
av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
return -1;
}
if (in_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "Frame data is larger than input buffer\n");
return -1;
}
samples_end = samples + out_size;
if (in_size == out_size) {
for (i = 0; i < out_size; i++)
*samples++ = *buf++;
*data_size = out_size;
return buf_size;
}
while (samples < samples_end && buf - avpkt->data < buf_size) {
int code, smp, size;
uint8_t count;
code = (*buf) >> 6;
count = (*buf) & 0x3F;
buf++;
switch (code) {
case 0: smp = 4; break;
case 1: smp = 2; break;
case 2: smp = (count & 0x20) ? 1 : count + 1; break;
default: smp = count + 1; break;
}
if (samples_end - samples < smp)
break;
size = ((code == 2 && (count & 0x20)) || code == 3) ? 0 : count + 1;
if ((buf - avpkt->data) + size > buf_size)
break;
switch(code) {
case 0:
for (count++; count > 0; count--) {
code = *buf++;
sample += ws_adpcm_2bit[code & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 2) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 4) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_2bit[(code >> 6) & 0x3];
sample = av_clip_uint8(sample);
*samples++ = sample;
}
break;
case 1:
for (count++; count > 0; count--) {
code = *buf++;
sample += ws_adpcm_4bit[code & 0xF];
sample = av_clip_uint8(sample);
*samples++ = sample;
sample += ws_adpcm_4bit[code >> 4];
sample = av_clip_uint8(sample);
*samples++ = sample;
}
break;
case 2:
if (count & 0x20) {
int8_t t;
t = count;
t <<= 3;
sample += t >> 3;
sample = av_clip_uint8(sample);
*samples++ = sample;
} else {
for (count++; count > 0; count--) {
*samples++ = *buf++;
}
sample = buf[-1];
}
break;
default:
for(count++; count > 0; count--) {
*samples++ = sample;
}
}
}
*data_size = samples - (uint8_t *)data;
return buf_size;
}
| 1threat
|
replace the value with small value for example :
I have column in table of customer contains very tall number like this 7351267613862 I want replace the value with small value for example.
> 7351267613862 = 1
> 7371867613863 = 2
> 7351267993855 = 3
How can do this by using SQL script.
Note: this value cloud appear in the table many times.
| 0debug
|
C# isnt correctly subtracting my values : i have a set value and a user entry text box, where i have it set to only numeric entry's, followed by converting it to an int, which all works, but when i run the code and put in a number smaller then the set value it doesn't work out properly
TL:DR
(set value 20, user entered value 12, code returns -4)
private void LSum_Load(object sender, EventArgs e)
{
PassengersTXT.Text = LEFcPassanger.sendtext;
DepartDateTXT.Text = LutonDepart.sendtext;
DepTimeTXT.Text = LutonSat.sendtext;
TravelTypeTXT.Text = LEClass.sendtext;
DepartTXT.Text = Form2.sendtext;
ArriveTXT.Text = LArrive.sendtext;
}
if( TravelTypeTXT.Text == "First Class")
{
Seating.FirstClass -= Convert.ToInt32(PassengersTXT.Text);
if (Seating.FirstClass <= 0)
{
MessageBox.Show("Not Enough Seats in First Class", "ERROR!",
MessageBoxButtons.OK, MessageBoxIcon.Error);
LEFcPassanger form = new LEFcPassanger();
form.Show();
this.Close();
}
else
{
Seating.FirstClass -= Convert.ToInt32(PassengersTXT.Text);
AppFin frm = new AppFin();
frm.Show();
this.Close();
}
//seperate class
class Seating
{
public static int FirstClass = 20;
public static int BusinessClass = 36;
public static int EconomyClass = 84;
public static int TotalSeats = 140;
}
| 0debug
|
offset_t url_filesize(URLContext *h)
{
offset_t pos, size;
size= url_seek(h, 0, AVSEEK_SIZE);
if(size<0){
pos = url_seek(h, 0, SEEK_CUR);
size = url_seek(h, -1, SEEK_END)+1;
url_seek(h, pos, SEEK_SET);
}
return size;
}
| 1threat
|
Pandas Groupby: Count and mean combined : <p>Working with PANDAS to try and summarise a dataframe as a count of certain categories, as well as the means sentiment score for these categories.</p>
<p>There is table full of strings which have different sentiment scores, and I want to group each text source by saying how many posts they have, as well as the average sentiment of these posts.</p>
<p>My (simplified) dataframe looks like this:</p>
<pre><code>source text sent
--------------------------------
bar some string 0.13
foo alt string -0.8
bar another str 0.7
foo some text -0.2
foo more text -0.5
</code></pre>
<p>The output from this should be something like this:</p>
<pre><code>source count mean_sent
-----------------------------
foo 3 -0.5
bar 2 0.415
</code></pre>
<p>The answer is somewhere along the lines of:</p>
<pre><code>df['sent'].groupby(df['source']).mean()
</code></pre>
<p>Yet only gives each source and it's mean, with no column headers.</p>
<p>Thanks in advance!</p>
| 0debug
|
static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns)
{
uint16_t insns[5];
int ld_adr, ld_dst, ld_mop;
int op_dst, op_src, op_opc;
int mv_src, mt_dst, st_src, st_mop;
TCGv op_arg;
uint32_t pc = ctx->pc;
uint32_t pc_end = ctx->tb->cs_base;
int backup = sextract32(ctx->tbflags, GUSA_SHIFT, 8);
int max_insns = (pc_end - pc) / 2;
int i;
if (pc != pc_end + backup || max_insns < 2) {
ctx->envflags &= ~GUSA_MASK;
return 0;
}
if (ctx->tbflags & GUSA_EXCLUSIVE) {
*pmax_insns = max_insns;
return 0;
}
if (max_insns > ARRAY_SIZE(insns)) {
goto fail;
}
for (i = 0; i < max_insns; ++i) {
insns[i] = cpu_lduw_code(env, pc + i * 2);
}
ld_adr = ld_dst = ld_mop = -1;
mv_src = -1;
op_dst = op_src = op_opc = -1;
mt_dst = -1;
st_src = st_mop = -1;
TCGV_UNUSED(op_arg);
i = 0;
#define NEXT_INSN \
do { if (i >= max_insns) goto fail; ctx->opcode = insns[i++]; } while (0)
NEXT_INSN;
switch (ctx->opcode & 0xf00f) {
case 0x6000:
ld_mop = MO_SB;
break;
case 0x6001:
ld_mop = MO_TESW;
break;
case 0x6002:
ld_mop = MO_TESL;
break;
default:
goto fail;
}
ld_adr = B7_4;
ld_dst = B11_8;
if (ld_adr == ld_dst) {
goto fail;
}
op_dst = ld_dst;
NEXT_INSN;
switch (ctx->opcode & 0xf00f) {
case 0x6003:
op_dst = B11_8;
mv_src = B7_4;
if (op_dst == ld_dst) {
goto fail;
}
if (mv_src != ld_dst) {
op_src = ld_dst;
}
break;
default:
--i;
}
NEXT_INSN;
switch (ctx->opcode & 0xf00f) {
case 0x300c:
op_opc = INDEX_op_add_i32;
goto do_reg_op;
case 0x2009:
op_opc = INDEX_op_and_i32;
goto do_reg_op;
case 0x200a:
op_opc = INDEX_op_xor_i32;
goto do_reg_op;
case 0x200b:
op_opc = INDEX_op_or_i32;
do_reg_op:
if (op_dst != B11_8) {
goto fail;
}
if (op_src < 0) {
op_src = B7_4;
} else if (op_src == B7_4) {
op_src = mv_src;
} else {
goto fail;
}
op_arg = REG(op_src);
break;
case 0x6007:
if (ld_dst != B7_4 || mv_src >= 0) {
goto fail;
}
op_dst = B11_8;
op_opc = INDEX_op_xor_i32;
op_arg = tcg_const_i32(-1);
break;
case 0x7000 ... 0x700f:
if (op_dst != B11_8 || mv_src >= 0) {
goto fail;
}
op_opc = INDEX_op_add_i32;
op_arg = tcg_const_i32(B7_0s);
break;
case 0x3000:
if ((ld_dst == B11_8) + (ld_dst == B7_4) != 1 || mv_src >= 0) {
goto fail;
}
op_opc = INDEX_op_setcond_i32;
op_src = (ld_dst == B11_8 ? B7_4 : B11_8);
op_arg = REG(op_src);
NEXT_INSN;
switch (ctx->opcode & 0xff00) {
case 0x8b00:
case 0x8f00:
if (pc + (i + 1 + B7_0s) * 2 != pc_end) {
goto fail;
}
if ((ctx->opcode & 0xff00) == 0x8b00) {
break;
}
NEXT_INSN;
if ((ctx->opcode & 0xf0ff) == 0x0029) {
mt_dst = B11_8;
} else {
goto fail;
}
break;
default:
goto fail;
}
break;
case 0x2008:
if (ld_dst != B11_8 || ld_dst != B7_4 || mv_src >= 0) {
goto fail;
}
op_opc = INDEX_op_setcond_i32;
op_arg = tcg_const_i32(0);
NEXT_INSN;
if ((ctx->opcode & 0xff00) != 0x8900
|| pc + (i + 1 + B7_0s) * 2 != pc_end) {
goto fail;
}
break;
default:
--i;
}
if (i != max_insns - 1) {
goto fail;
}
NEXT_INSN;
switch (ctx->opcode & 0xf00f) {
case 0x2000:
st_mop = MO_UB;
break;
case 0x2001:
st_mop = MO_UW;
break;
case 0x2002:
st_mop = MO_UL;
break;
default:
goto fail;
}
if (ld_adr != B11_8 || st_mop != (ld_mop & MO_SIZE)) {
goto fail;
}
st_src = B7_4;
#undef NEXT_INSN
tcg_gen_insn_start(pc, ctx->envflags);
switch (op_opc) {
case -1:
if (st_src == ld_dst || mv_src >= 0) {
goto fail;
}
tcg_gen_atomic_xchg_i32(REG(ld_dst), REG(ld_adr), REG(st_src),
ctx->memidx, ld_mop);
break;
case INDEX_op_add_i32:
if (op_dst != st_src) {
goto fail;
}
if (op_dst == ld_dst && st_mop == MO_UL) {
tcg_gen_atomic_add_fetch_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
} else {
tcg_gen_atomic_fetch_add_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
if (op_dst != ld_dst) {
tcg_gen_add_i32(REG(op_dst), REG(ld_dst), op_arg);
}
}
break;
case INDEX_op_and_i32:
if (op_dst != st_src) {
goto fail;
}
if (op_dst == ld_dst) {
tcg_gen_atomic_and_fetch_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
} else {
tcg_gen_atomic_fetch_and_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
tcg_gen_and_i32(REG(op_dst), REG(ld_dst), op_arg);
}
break;
case INDEX_op_or_i32:
if (op_dst != st_src) {
goto fail;
}
if (op_dst == ld_dst) {
tcg_gen_atomic_or_fetch_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
} else {
tcg_gen_atomic_fetch_or_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
tcg_gen_or_i32(REG(op_dst), REG(ld_dst), op_arg);
}
break;
case INDEX_op_xor_i32:
if (op_dst != st_src) {
goto fail;
}
if (op_dst == ld_dst) {
tcg_gen_atomic_xor_fetch_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
} else {
tcg_gen_atomic_fetch_xor_i32(REG(ld_dst), REG(ld_adr),
op_arg, ctx->memidx, ld_mop);
tcg_gen_xor_i32(REG(op_dst), REG(ld_dst), op_arg);
}
break;
case INDEX_op_setcond_i32:
if (st_src == ld_dst) {
goto fail;
}
tcg_gen_atomic_cmpxchg_i32(REG(ld_dst), REG(ld_adr), op_arg,
REG(st_src), ctx->memidx, ld_mop);
tcg_gen_setcond_i32(TCG_COND_EQ, cpu_sr_t, REG(ld_dst), op_arg);
if (mt_dst >= 0) {
tcg_gen_mov_i32(REG(mt_dst), cpu_sr_t);
}
break;
default:
g_assert_not_reached();
}
if (op_src < 0) {
tcg_temp_free_i32(op_arg);
}
ctx->envflags &= ~GUSA_MASK;
ctx->pc = pc_end;
return max_insns;
fail:
qemu_log_mask(LOG_UNIMP, "Unrecognized gUSA sequence %08x-%08x\n",
pc, pc_end);
tcg_gen_insn_start(pc, ctx->envflags);
ctx->envflags |= GUSA_EXCLUSIVE;
gen_save_cpu_state(ctx, false);
gen_helper_exclusive(cpu_env);
ctx->bstate = BS_EXCP;
ctx->pc = pc_end;
return 1;
}
| 1threat
|
C#, Windows Forms, DataGridView: Why am I Getting Null DataTable? : OK guys. It's been a LONG time since I worked with DataGridViews, so please help me understand what I am doing wrong. I created a very simple test to boil this issue down to common elements. I have an MS Access DB with 1 and only 1 table in it. 2 columns (ID, Name) and added 4 rows of data to the table. I added a datasource to my Winforms project and added a test form with 1 and only 1 control, a datagridview, and bound that grid to the table in the datasource. My Form_Load looks like this:
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'testDBDataSet.TestTable' table. You can move, or remove it, as needed.
this.testTableTableAdapter.Fill(this.testDBDataSet.TestTable);
// TODO: This line of code loads data into the 'testDBDataSet.TestTable' table. You can move, or remove it, as needed.
this.testTableTableAdapter.Fill(this.testDBDataSet.TestTable);
BindingSource bs = (BindingSource)dgvTestData.DataSource;
DataTable dt = (dgvTestData.DataSource) as DataTable;
}
When I step past the last line of code, dt is null. What am I missing? I know it is something simple and probably obvious, but I don't see it. If I just run the code back to the form, the datagrid has data in it. What am I doing wrong?
Happy 4th, btw!
| 0debug
|
is an activity a class : Sorry for the noob question - still learning.
When building android apps in Android studio, every new activity has it's own XML and java class. I'm trying to get an understanding of the overall architecture - when creating a new activity how is this stacked in the package as a whole?
| 0debug
|
How do I get the Progress bar filled up by the amount of time I hold down? : <p>In Objective c, how can I implement the progress bar being filled during the time I press the button?</p>
<p>I can not even start because I'm new.</p>
| 0debug
|
How to "cd" between directories using a python script : <p>I'm writing a test script that is supposed to cd from the current directory into a new one if that path is confirmed to exist and be a directory</p>
<pre><code>serial_number = input("Enter serial number: ")
directory = "/etc/bin/foo"
if os.path.exists(directory) and os.path.isdir(directory):
#cd into directory?
subprocess.call(['cd ..' + directory])
</code></pre>
<p>My dilemma is that I don't know how to properly pass a variable into a subprocess command, or whether or not I should use call or Popen. When I try the above code, it comes back with an error saying that <code>No such file or directory "cd ../etc/bin/"</code>. I need is to travel back one directory from the current directory so then I can enter <code>/etc</code> and read some files in there. Any advice?</p>
| 0debug
|
what is the http status code returned by the server : <p>When the password entered by the client is wrong, what is the http status code returned by the server? 401 or 200? Thank you. i have responsed to client 403,they said 403 is wrong,then the 200 is right</p>
| 0debug
|
I want to print the status of connection. like my phone is connected in wifi or gprs. in android studio : <p>I don't want to show the available connection. I just want to show that am i connected with gprs or wifi. that's it.</p>
| 0debug
|
Check how many times was form submited : <p>I am wondering how can I check is someone tried to log in on site and if he fails login few times to redirect him on forgot password page. I am little word less so I don't know what should I look for. I should try it with jquery and ajax.
I think about something with if password is wrong to echo password is wrong but on third time to send user on forgot page. Now my question is how can I check how many times did someone press submit button with error message for wrong password or username. </p>
| 0debug
|
using regular expressions in javascript : I am trying to manipulate the string as following
myStr = 'str1/str2/str3a // str3b'. I would like to get the last value seperated by delimiter '%s/%s', in this case 'str3a // str3b'. I tried using string split, but it splits based on '//' and returns str3b. Is there a way i can address this problem using regex?
Thanks
| 0debug
|
sharing SQLite database information in android : I have question regarding my android app. while I am doing search for sqlite database concepts and advantages, I found that they said SQLite is serverless or you don't have to deal with server when you using it.
My question is, if SQLite is serverless , how two or more devices can share information in my app between them without server?
| 0debug
|
static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
{
unsigned int opc, rs1, rs2, rd;
TCGv cpu_src1, cpu_src2;
TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32;
TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64;
target_long simm;
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
tcg_gen_debug_insn_start(dc->pc);
}
opc = GET_FIELD(insn, 0, 1);
rd = GET_FIELD(insn, 2, 6);
switch (opc) {
case 0:
{
unsigned int xop = GET_FIELD(insn, 7, 9);
int32_t target;
switch (xop) {
#ifdef TARGET_SPARC64
case 0x1:
{
int cc;
target = GET_FIELD_SP(insn, 0, 18);
target = sign_extend(target, 19);
target <<= 2;
cc = GET_FIELD_SP(insn, 20, 21);
if (cc == 0)
do_branch(dc, target, insn, 0);
else if (cc == 2)
do_branch(dc, target, insn, 1);
else
goto illegal_insn;
goto jmp_insn;
}
case 0x3:
{
target = GET_FIELD_SP(insn, 0, 13) |
(GET_FIELD_SP(insn, 20, 21) << 14);
target = sign_extend(target, 16);
target <<= 2;
cpu_src1 = get_src1(dc, insn);
do_branch_reg(dc, target, insn, cpu_src1);
goto jmp_insn;
}
case 0x5:
{
int cc = GET_FIELD_SP(insn, 20, 21);
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
target = GET_FIELD_SP(insn, 0, 18);
target = sign_extend(target, 19);
target <<= 2;
do_fbranch(dc, target, insn, cc);
goto jmp_insn;
}
#else
case 0x7:
{
goto ncp_insn;
}
#endif
case 0x2:
{
target = GET_FIELD(insn, 10, 31);
target = sign_extend(target, 22);
target <<= 2;
do_branch(dc, target, insn, 0);
goto jmp_insn;
}
case 0x6:
{
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
target = GET_FIELD(insn, 10, 31);
target = sign_extend(target, 22);
target <<= 2;
do_fbranch(dc, target, insn, 0);
goto jmp_insn;
}
case 0x4:
if (rd) {
uint32_t value = GET_FIELD(insn, 10, 31);
TCGv t = gen_dest_gpr(dc, rd);
tcg_gen_movi_tl(t, value << 10);
gen_store_gpr(dc, rd, t);
}
break;
case 0x0:
default:
goto illegal_insn;
}
break;
}
break;
case 1:
{
target_long target = GET_FIELDs(insn, 2, 31) << 2;
TCGv o7 = gen_dest_gpr(dc, 15);
tcg_gen_movi_tl(o7, dc->pc);
gen_store_gpr(dc, 15, o7);
target += dc->pc;
gen_mov_pc_npc(dc);
#ifdef TARGET_SPARC64
if (unlikely(AM_CHECK(dc))) {
target &= 0xffffffffULL;
}
#endif
dc->npc = target;
}
goto jmp_insn;
case 2:
{
unsigned int xop = GET_FIELD(insn, 7, 12);
if (xop == 0x3a) {
int cond = GET_FIELD(insn, 3, 6);
TCGv_i32 trap;
int l1 = -1, mask;
if (cond == 0) {
break;
}
save_state(dc);
if (cond != 8) {
DisasCompare cmp;
#ifdef TARGET_SPARC64
int cc = GET_FIELD_SP(insn, 11, 12);
if (cc == 0) {
gen_compare(&cmp, 0, cond, dc);
} else if (cc == 2) {
gen_compare(&cmp, 1, cond, dc);
} else {
goto illegal_insn;
}
#else
gen_compare(&cmp, 0, cond, dc);
#endif
l1 = gen_new_label();
tcg_gen_brcond_tl(tcg_invert_cond(cmp.cond),
cmp.c1, cmp.c2, l1);
free_compare(&cmp);
}
mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc)
? UA2005_HTRAP_MASK : V8_TRAP_MASK);
trap = tcg_temp_new_i32();
rs1 = GET_FIELD_SP(insn, 14, 18);
if (IS_IMM) {
rs2 = GET_FIELD_SP(insn, 0, 6);
if (rs1 == 0) {
tcg_gen_movi_i32(trap, (rs2 & mask) + TT_TRAP);
mask = 0;
} else {
TCGv t1 = gen_load_gpr(dc, rs1);
tcg_gen_trunc_tl_i32(trap, t1);
tcg_gen_addi_i32(trap, trap, rs2);
}
} else {
TCGv t1, t2;
rs2 = GET_FIELD_SP(insn, 0, 4);
t1 = gen_load_gpr(dc, rs1);
t2 = gen_load_gpr(dc, rs2);
tcg_gen_add_tl(t1, t1, t2);
tcg_gen_trunc_tl_i32(trap, t1);
}
if (mask != 0) {
tcg_gen_andi_i32(trap, trap, mask);
tcg_gen_addi_i32(trap, trap, TT_TRAP);
}
gen_helper_raise_exception(cpu_env, trap);
tcg_temp_free_i32(trap);
if (cond == 8) {
dc->is_br = 1;
goto jmp_insn;
} else {
gen_set_label(l1);
break;
}
} else if (xop == 0x28) {
rs1 = GET_FIELD(insn, 13, 17);
switch(rs1) {
case 0:
#ifndef TARGET_SPARC64
case 0x01 ... 0x0e:
case 0x0f:
case 0x10 ... 0x1f:
if (rs1 == 0x11 && dc->def->features & CPU_FEATURE_ASR17) {
TCGv t = gen_dest_gpr(dc, rd);
tcg_gen_movi_tl(t, (1 << 8) | (dc->def->nwindows - 1));
gen_store_gpr(dc, rd, t);
break;
}
#endif
gen_store_gpr(dc, rd, cpu_y);
break;
#ifdef TARGET_SPARC64
case 0x2:
update_psr(dc);
gen_helper_rdccr(cpu_dst, cpu_env);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x3:
tcg_gen_ext_i32_tl(cpu_dst, cpu_asi);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x4:
{
TCGv_ptr r_tickptr;
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, tick));
gen_helper_tick_get_count(cpu_dst, r_tickptr);
tcg_temp_free_ptr(r_tickptr);
gen_store_gpr(dc, rd, cpu_dst);
}
break;
case 0x5:
{
TCGv t = gen_dest_gpr(dc, rd);
if (unlikely(AM_CHECK(dc))) {
tcg_gen_movi_tl(t, dc->pc & 0xffffffffULL);
} else {
tcg_gen_movi_tl(t, dc->pc);
}
gen_store_gpr(dc, rd, t);
}
break;
case 0x6:
tcg_gen_ext_i32_tl(cpu_dst, cpu_fprs);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0xf:
break;
case 0x13:
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
gen_store_gpr(dc, rd, cpu_gsr);
break;
case 0x16:
tcg_gen_ext_i32_tl(cpu_dst, cpu_softint);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x17:
gen_store_gpr(dc, rd, cpu_tick_cmpr);
break;
case 0x18:
{
TCGv_ptr r_tickptr;
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, stick));
gen_helper_tick_get_count(cpu_dst, r_tickptr);
tcg_temp_free_ptr(r_tickptr);
gen_store_gpr(dc, rd, cpu_dst);
}
break;
case 0x19:
gen_store_gpr(dc, rd, cpu_stick_cmpr);
break;
case 0x10:
case 0x11:
case 0x12:
case 0x14:
case 0x15:
#endif
default:
goto illegal_insn;
}
#if !defined(CONFIG_USER_ONLY)
} else if (xop == 0x29) {
#ifndef TARGET_SPARC64
if (!supervisor(dc)) {
goto priv_insn;
}
update_psr(dc);
gen_helper_rdpsr(cpu_dst, cpu_env);
#else
CHECK_IU_FEATURE(dc, HYPV);
if (!hypervisor(dc))
goto priv_insn;
rs1 = GET_FIELD(insn, 13, 17);
switch (rs1) {
case 0:
break;
case 1:
break;
case 3:
tcg_gen_mov_tl(cpu_dst, cpu_hintp);
break;
case 5:
tcg_gen_mov_tl(cpu_dst, cpu_htba);
break;
case 6:
tcg_gen_mov_tl(cpu_dst, cpu_hver);
break;
case 31:
tcg_gen_mov_tl(cpu_dst, cpu_hstick_cmpr);
break;
default:
goto illegal_insn;
}
#endif
gen_store_gpr(dc, rd, cpu_dst);
break;
} else if (xop == 0x2a) {
if (!supervisor(dc))
goto priv_insn;
#ifdef TARGET_SPARC64
rs1 = GET_FIELD(insn, 13, 17);
switch (rs1) {
case 0:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_ld_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tpc));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 1:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_ld_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tnpc));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 2:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_ld_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tstate));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 3:
{
TCGv_ptr r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_ld32s_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tt));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 4:
{
TCGv_ptr r_tickptr;
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, tick));
gen_helper_tick_get_count(cpu_tmp0, r_tickptr);
tcg_temp_free_ptr(r_tickptr);
}
break;
case 5:
tcg_gen_mov_tl(cpu_tmp0, cpu_tbr);
break;
case 6:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, pstate));
break;
case 7:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, tl));
break;
case 8:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, psrpil));
break;
case 9:
gen_helper_rdcwp(cpu_tmp0, cpu_env);
break;
case 10:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, cansave));
break;
case 11:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, canrestore));
break;
case 12:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, cleanwin));
break;
case 13:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, otherwin));
break;
case 14:
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, wstate));
break;
case 16:
CHECK_IU_FEATURE(dc, GL);
tcg_gen_ld32s_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, gl));
break;
case 26:
CHECK_IU_FEATURE(dc, HYPV);
if (!hypervisor(dc))
goto priv_insn;
tcg_gen_mov_tl(cpu_tmp0, cpu_ssr);
break;
case 31:
tcg_gen_mov_tl(cpu_tmp0, cpu_ver);
break;
case 15:
default:
goto illegal_insn;
}
#else
tcg_gen_ext_i32_tl(cpu_tmp0, cpu_wim);
#endif
gen_store_gpr(dc, rd, cpu_tmp0);
break;
} else if (xop == 0x2b) {
#ifdef TARGET_SPARC64
save_state(dc);
gen_helper_flushw(cpu_env);
#else
if (!supervisor(dc))
goto priv_insn;
gen_store_gpr(dc, rd, cpu_tbr);
#endif
break;
#endif
} else if (xop == 0x34) {
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
gen_op_clear_ieee_excp_and_FTT();
rs1 = GET_FIELD(insn, 13, 17);
rs2 = GET_FIELD(insn, 27, 31);
xop = GET_FIELD(insn, 18, 26);
save_state(dc);
switch (xop) {
case 0x1:
cpu_src1_32 = gen_load_fpr_F(dc, rs2);
gen_store_fpr_F(dc, rd, cpu_src1_32);
break;
case 0x5:
gen_ne_fop_FF(dc, rd, rs2, gen_helper_fnegs);
break;
case 0x9:
gen_ne_fop_FF(dc, rd, rs2, gen_helper_fabss);
break;
case 0x29:
CHECK_FPU_FEATURE(dc, FSQRT);
gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts);
break;
case 0x2a:
CHECK_FPU_FEATURE(dc, FSQRT);
gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd);
break;
case 0x2b:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_QQ(dc, rd, rs2, gen_helper_fsqrtq);
break;
case 0x41:
gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fadds);
break;
case 0x42:
gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_faddd);
break;
case 0x43:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq);
break;
case 0x45:
gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fsubs);
break;
case 0x46:
gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fsubd);
break;
case 0x47:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq);
break;
case 0x49:
CHECK_FPU_FEATURE(dc, FMUL);
gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fmuls);
break;
case 0x4a:
CHECK_FPU_FEATURE(dc, FMUL);
gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld);
break;
case 0x4b:
CHECK_FPU_FEATURE(dc, FLOAT128);
CHECK_FPU_FEATURE(dc, FMUL);
gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq);
break;
case 0x4d:
gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fdivs);
break;
case 0x4e:
gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fdivd);
break;
case 0x4f:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fdivq);
break;
case 0x69:
CHECK_FPU_FEATURE(dc, FSMULD);
gen_fop_DFF(dc, rd, rs1, rs2, gen_helper_fsmuld);
break;
case 0x6e:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq);
break;
case 0xc4:
gen_fop_FF(dc, rd, rs2, gen_helper_fitos);
break;
case 0xc6:
gen_fop_FD(dc, rd, rs2, gen_helper_fdtos);
break;
case 0xc7:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos);
break;
case 0xc8:
gen_ne_fop_DF(dc, rd, rs2, gen_helper_fitod);
break;
case 0xc9:
gen_ne_fop_DF(dc, rd, rs2, gen_helper_fstod);
break;
case 0xcb:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod);
break;
case 0xcc:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_ne_fop_QF(dc, rd, rs2, gen_helper_fitoq);
break;
case 0xcd:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_ne_fop_QF(dc, rd, rs2, gen_helper_fstoq);
break;
case 0xce:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq);
break;
case 0xd1:
gen_fop_FF(dc, rd, rs2, gen_helper_fstoi);
break;
case 0xd2:
gen_fop_FD(dc, rd, rs2, gen_helper_fdtoi);
break;
case 0xd3:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi);
break;
#ifdef TARGET_SPARC64
case 0x2:
cpu_src1_64 = gen_load_fpr_D(dc, rs2);
gen_store_fpr_D(dc, rd, cpu_src1_64);
break;
case 0x3:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_move_Q(rd, rs2);
break;
case 0x6:
gen_ne_fop_DD(dc, rd, rs2, gen_helper_fnegd);
break;
case 0x7:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fnegq);
break;
case 0xa:
gen_ne_fop_DD(dc, rd, rs2, gen_helper_fabsd);
break;
case 0xb:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq);
break;
case 0x81:
gen_fop_DF(dc, rd, rs2, gen_helper_fstox);
break;
case 0x82:
gen_fop_DD(dc, rd, rs2, gen_helper_fdtox);
break;
case 0x83:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox);
break;
case 0x84:
gen_fop_FD(dc, rd, rs2, gen_helper_fxtos);
break;
case 0x88:
gen_fop_DD(dc, rd, rs2, gen_helper_fxtod);
break;
case 0x8c:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq);
break;
#endif
default:
goto illegal_insn;
}
} else if (xop == 0x35) {
#ifdef TARGET_SPARC64
int cond;
#endif
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
gen_op_clear_ieee_excp_and_FTT();
rs1 = GET_FIELD(insn, 13, 17);
rs2 = GET_FIELD(insn, 27, 31);
xop = GET_FIELD(insn, 18, 26);
save_state(dc);
#ifdef TARGET_SPARC64
#define FMOVR(sz) \
do { \
DisasCompare cmp; \
cond = GET_FIELD_SP(insn, 14, 17); \
cpu_src1 = get_src1(dc, insn); \
gen_compare_reg(&cmp, cond, cpu_src1); \
gen_fmov##sz(dc, &cmp, rd, rs2); \
free_compare(&cmp); \
} while (0)
if ((xop & 0x11f) == 0x005) {
FMOVR(s);
break;
} else if ((xop & 0x11f) == 0x006) {
FMOVR(d);
break;
} else if ((xop & 0x11f) == 0x007) {
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVR(q);
break;
}
#undef FMOVR
#endif
switch (xop) {
#ifdef TARGET_SPARC64
#define FMOVCC(fcc, sz) \
do { \
DisasCompare cmp; \
cond = GET_FIELD_SP(insn, 14, 17); \
gen_fcompare(&cmp, fcc, cond); \
gen_fmov##sz(dc, &cmp, rd, rs2); \
free_compare(&cmp); \
} while (0)
case 0x001:
FMOVCC(0, s);
break;
case 0x002:
FMOVCC(0, d);
break;
case 0x003:
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVCC(0, q);
break;
case 0x041:
FMOVCC(1, s);
break;
case 0x042:
FMOVCC(1, d);
break;
case 0x043:
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVCC(1, q);
break;
case 0x081:
FMOVCC(2, s);
break;
case 0x082:
FMOVCC(2, d);
break;
case 0x083:
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVCC(2, q);
break;
case 0x0c1:
FMOVCC(3, s);
break;
case 0x0c2:
FMOVCC(3, d);
break;
case 0x0c3:
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVCC(3, q);
break;
#undef FMOVCC
#define FMOVCC(xcc, sz) \
do { \
DisasCompare cmp; \
cond = GET_FIELD_SP(insn, 14, 17); \
gen_compare(&cmp, xcc, cond, dc); \
gen_fmov##sz(dc, &cmp, rd, rs2); \
free_compare(&cmp); \
} while (0)
case 0x101:
FMOVCC(0, s);
break;
case 0x102:
FMOVCC(0, d);
break;
case 0x103:
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVCC(0, q);
break;
case 0x181:
FMOVCC(1, s);
break;
case 0x182:
FMOVCC(1, d);
break;
case 0x183:
CHECK_FPU_FEATURE(dc, FLOAT128);
FMOVCC(1, q);
break;
#undef FMOVCC
#endif
case 0x51:
cpu_src1_32 = gen_load_fpr_F(dc, rs1);
cpu_src2_32 = gen_load_fpr_F(dc, rs2);
gen_op_fcmps(rd & 3, cpu_src1_32, cpu_src2_32);
break;
case 0x52:
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_op_fcmpd(rd & 3, cpu_src1_64, cpu_src2_64);
break;
case 0x53:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_op_load_fpr_QT0(QFPREG(rs1));
gen_op_load_fpr_QT1(QFPREG(rs2));
gen_op_fcmpq(rd & 3);
break;
case 0x55:
cpu_src1_32 = gen_load_fpr_F(dc, rs1);
cpu_src2_32 = gen_load_fpr_F(dc, rs2);
gen_op_fcmpes(rd & 3, cpu_src1_32, cpu_src2_32);
break;
case 0x56:
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_op_fcmped(rd & 3, cpu_src1_64, cpu_src2_64);
break;
case 0x57:
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_op_load_fpr_QT0(QFPREG(rs1));
gen_op_load_fpr_QT1(QFPREG(rs2));
gen_op_fcmpeq(rd & 3);
break;
default:
goto illegal_insn;
}
} else if (xop == 0x2) {
TCGv dst = gen_dest_gpr(dc, rd);
rs1 = GET_FIELD(insn, 13, 17);
if (rs1 == 0) {
if (IS_IMM) {
simm = GET_FIELDs(insn, 19, 31);
tcg_gen_movi_tl(dst, simm);
gen_store_gpr(dc, rd, dst);
} else {
rs2 = GET_FIELD(insn, 27, 31);
if (rs2 == 0) {
tcg_gen_movi_tl(dst, 0);
gen_store_gpr(dc, rd, dst);
} else {
cpu_src2 = gen_load_gpr(dc, rs2);
gen_store_gpr(dc, rd, cpu_src2);
}
}
} else {
cpu_src1 = get_src1(dc, insn);
if (IS_IMM) {
simm = GET_FIELDs(insn, 19, 31);
tcg_gen_ori_tl(dst, cpu_src1, simm);
gen_store_gpr(dc, rd, dst);
} else {
rs2 = GET_FIELD(insn, 27, 31);
if (rs2 == 0) {
gen_store_gpr(dc, rd, cpu_src1);
} else {
cpu_src2 = gen_load_gpr(dc, rs2);
tcg_gen_or_tl(dst, cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, dst);
}
}
}
#ifdef TARGET_SPARC64
} else if (xop == 0x25) {
cpu_src1 = get_src1(dc, insn);
if (IS_IMM) {
simm = GET_FIELDs(insn, 20, 31);
if (insn & (1 << 12)) {
tcg_gen_shli_i64(cpu_dst, cpu_src1, simm & 0x3f);
} else {
tcg_gen_shli_i64(cpu_dst, cpu_src1, simm & 0x1f);
}
} else {
rs2 = GET_FIELD(insn, 27, 31);
cpu_src2 = gen_load_gpr(dc, rs2);
if (insn & (1 << 12)) {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f);
} else {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f);
}
tcg_gen_shl_i64(cpu_dst, cpu_src1, cpu_tmp0);
}
gen_store_gpr(dc, rd, cpu_dst);
} else if (xop == 0x26) {
cpu_src1 = get_src1(dc, insn);
if (IS_IMM) {
simm = GET_FIELDs(insn, 20, 31);
if (insn & (1 << 12)) {
tcg_gen_shri_i64(cpu_dst, cpu_src1, simm & 0x3f);
} else {
tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL);
tcg_gen_shri_i64(cpu_dst, cpu_dst, simm & 0x1f);
}
} else {
rs2 = GET_FIELD(insn, 27, 31);
cpu_src2 = gen_load_gpr(dc, rs2);
if (insn & (1 << 12)) {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f);
tcg_gen_shr_i64(cpu_dst, cpu_src1, cpu_tmp0);
} else {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f);
tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL);
tcg_gen_shr_i64(cpu_dst, cpu_dst, cpu_tmp0);
}
}
gen_store_gpr(dc, rd, cpu_dst);
} else if (xop == 0x27) {
cpu_src1 = get_src1(dc, insn);
if (IS_IMM) {
simm = GET_FIELDs(insn, 20, 31);
if (insn & (1 << 12)) {
tcg_gen_sari_i64(cpu_dst, cpu_src1, simm & 0x3f);
} else {
tcg_gen_ext32s_i64(cpu_dst, cpu_src1);
tcg_gen_sari_i64(cpu_dst, cpu_dst, simm & 0x1f);
}
} else {
rs2 = GET_FIELD(insn, 27, 31);
cpu_src2 = gen_load_gpr(dc, rs2);
if (insn & (1 << 12)) {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f);
tcg_gen_sar_i64(cpu_dst, cpu_src1, cpu_tmp0);
} else {
tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f);
tcg_gen_ext32s_i64(cpu_dst, cpu_src1);
tcg_gen_sar_i64(cpu_dst, cpu_dst, cpu_tmp0);
}
}
gen_store_gpr(dc, rd, cpu_dst);
#endif
} else if (xop < 0x36) {
if (xop < 0x20) {
cpu_src1 = get_src1(dc, insn);
cpu_src2 = get_src2(dc, insn);
switch (xop & ~0x10) {
case 0x0:
if (xop & 0x10) {
gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD);
dc->cc_op = CC_OP_ADD;
} else {
tcg_gen_add_tl(cpu_dst, cpu_src1, cpu_src2);
}
break;
case 0x1:
tcg_gen_and_tl(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0x2:
tcg_gen_or_tl(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0x3:
tcg_gen_xor_tl(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0x4:
if (xop & 0x10) {
gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB);
dc->cc_op = CC_OP_SUB;
} else {
tcg_gen_sub_tl(cpu_dst, cpu_src1, cpu_src2);
}
break;
case 0x5:
tcg_gen_andc_tl(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0x6:
tcg_gen_orc_tl(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0x7:
tcg_gen_eqv_tl(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0x8:
gen_op_addx_int(dc, cpu_dst, cpu_src1, cpu_src2,
(xop & 0x10));
break;
#ifdef TARGET_SPARC64
case 0x9:
tcg_gen_mul_i64(cpu_dst, cpu_src1, cpu_src2);
break;
#endif
case 0xa:
CHECK_IU_FEATURE(dc, MUL);
gen_op_umul(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0xb:
CHECK_IU_FEATURE(dc, MUL);
gen_op_smul(cpu_dst, cpu_src1, cpu_src2);
if (xop & 0x10) {
tcg_gen_mov_tl(cpu_cc_dst, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
dc->cc_op = CC_OP_LOGIC;
}
break;
case 0xc:
gen_op_subx_int(dc, cpu_dst, cpu_src1, cpu_src2,
(xop & 0x10));
break;
#ifdef TARGET_SPARC64
case 0xd:
gen_helper_udivx(cpu_dst, cpu_env, cpu_src1, cpu_src2);
break;
#endif
case 0xe:
CHECK_IU_FEATURE(dc, DIV);
if (xop & 0x10) {
gen_helper_udiv_cc(cpu_dst, cpu_env, cpu_src1,
cpu_src2);
dc->cc_op = CC_OP_DIV;
} else {
gen_helper_udiv(cpu_dst, cpu_env, cpu_src1,
cpu_src2);
}
break;
case 0xf:
CHECK_IU_FEATURE(dc, DIV);
if (xop & 0x10) {
gen_helper_sdiv_cc(cpu_dst, cpu_env, cpu_src1,
cpu_src2);
dc->cc_op = CC_OP_DIV;
} else {
gen_helper_sdiv(cpu_dst, cpu_env, cpu_src1,
cpu_src2);
}
break;
default:
goto illegal_insn;
}
gen_store_gpr(dc, rd, cpu_dst);
} else {
cpu_src1 = get_src1(dc, insn);
cpu_src2 = get_src2(dc, insn);
switch (xop) {
case 0x20:
gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_TADD);
dc->cc_op = CC_OP_TADD;
break;
case 0x21:
gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_TSUB);
dc->cc_op = CC_OP_TSUB;
break;
case 0x22:
gen_helper_taddcctv(cpu_dst, cpu_env,
cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
dc->cc_op = CC_OP_TADDTV;
break;
case 0x23:
gen_helper_tsubcctv(cpu_dst, cpu_env,
cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
dc->cc_op = CC_OP_TSUBTV;
break;
case 0x24:
update_psr(dc);
gen_op_mulscc(cpu_dst, cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD);
dc->cc_op = CC_OP_ADD;
break;
#ifndef TARGET_SPARC64
case 0x25:
if (IS_IMM) {
simm = GET_FIELDs(insn, 20, 31);
tcg_gen_shli_tl(cpu_dst, cpu_src1, simm & 0x1f);
} else {
tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f);
tcg_gen_shl_tl(cpu_dst, cpu_src1, cpu_tmp0);
}
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x26:
if (IS_IMM) {
simm = GET_FIELDs(insn, 20, 31);
tcg_gen_shri_tl(cpu_dst, cpu_src1, simm & 0x1f);
} else {
tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f);
tcg_gen_shr_tl(cpu_dst, cpu_src1, cpu_tmp0);
}
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x27:
if (IS_IMM) {
simm = GET_FIELDs(insn, 20, 31);
tcg_gen_sari_tl(cpu_dst, cpu_src1, simm & 0x1f);
} else {
tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f);
tcg_gen_sar_tl(cpu_dst, cpu_src1, cpu_tmp0);
}
gen_store_gpr(dc, rd, cpu_dst);
break;
#endif
case 0x30:
{
switch(rd) {
case 0:
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff);
break;
#ifndef TARGET_SPARC64
case 0x01 ... 0x0f:
case 0x10 ... 0x1f:
break;
#else
case 0x2:
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
gen_helper_wrccr(cpu_env, cpu_tmp0);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS);
dc->cc_op = CC_OP_FLAGS;
break;
case 0x3:
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0xff);
tcg_gen_trunc_tl_i32(cpu_asi, cpu_tmp0);
break;
case 0x6:
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
tcg_gen_trunc_tl_i32(cpu_fprs, cpu_tmp0);
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
dc->is_br = 1;
break;
case 0xf:
#if !defined(CONFIG_USER_ONLY)
if (supervisor(dc)) {
;
}
#endif
break;
case 0x13:
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
tcg_gen_xor_tl(cpu_gsr, cpu_src1, cpu_src2);
break;
case 0x14:
if (!supervisor(dc))
goto illegal_insn;
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
gen_helper_set_softint(cpu_env, cpu_tmp0);
break;
case 0x15:
if (!supervisor(dc))
goto illegal_insn;
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
gen_helper_clear_softint(cpu_env, cpu_tmp0);
break;
case 0x16:
if (!supervisor(dc))
goto illegal_insn;
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
gen_helper_write_softint(cpu_env, cpu_tmp0);
break;
case 0x17:
#if !defined(CONFIG_USER_ONLY)
if (!supervisor(dc))
goto illegal_insn;
#endif
{
TCGv_ptr r_tickptr;
tcg_gen_xor_tl(cpu_tick_cmpr, cpu_src1,
cpu_src2);
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, tick));
gen_helper_tick_set_limit(r_tickptr,
cpu_tick_cmpr);
tcg_temp_free_ptr(r_tickptr);
}
break;
case 0x18:
#if !defined(CONFIG_USER_ONLY)
if (!supervisor(dc))
goto illegal_insn;
#endif
{
TCGv_ptr r_tickptr;
tcg_gen_xor_tl(cpu_tmp0, cpu_src1,
cpu_src2);
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, stick));
gen_helper_tick_set_count(r_tickptr,
cpu_tmp0);
tcg_temp_free_ptr(r_tickptr);
}
break;
case 0x19:
#if !defined(CONFIG_USER_ONLY)
if (!supervisor(dc))
goto illegal_insn;
#endif
{
TCGv_ptr r_tickptr;
tcg_gen_xor_tl(cpu_stick_cmpr, cpu_src1,
cpu_src2);
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, stick));
gen_helper_tick_set_limit(r_tickptr,
cpu_stick_cmpr);
tcg_temp_free_ptr(r_tickptr);
}
break;
case 0x10:
case 0x11:
case 0x12:
#endif
default:
goto illegal_insn;
}
}
break;
#if !defined(CONFIG_USER_ONLY)
case 0x31:
{
if (!supervisor(dc))
goto priv_insn;
#ifdef TARGET_SPARC64
switch (rd) {
case 0:
gen_helper_saved(cpu_env);
break;
case 1:
gen_helper_restored(cpu_env);
break;
case 2:
case 3:
case 4:
case 5:
default:
goto illegal_insn;
}
#else
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
gen_helper_wrpsr(cpu_env, cpu_tmp0);
tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS);
dc->cc_op = CC_OP_FLAGS;
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
dc->is_br = 1;
#endif
}
break;
case 0x32:
{
if (!supervisor(dc))
goto priv_insn;
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
#ifdef TARGET_SPARC64
switch (rd) {
case 0:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_st_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tpc));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 1:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_st_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tnpc));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 2:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_st_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state,
tstate));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 3:
{
TCGv_ptr r_tsptr;
r_tsptr = tcg_temp_new_ptr();
gen_load_trap_state_at_tl(r_tsptr, cpu_env);
tcg_gen_st32_tl(cpu_tmp0, r_tsptr,
offsetof(trap_state, tt));
tcg_temp_free_ptr(r_tsptr);
}
break;
case 4:
{
TCGv_ptr r_tickptr;
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, tick));
gen_helper_tick_set_count(r_tickptr,
cpu_tmp0);
tcg_temp_free_ptr(r_tickptr);
}
break;
case 5:
tcg_gen_mov_tl(cpu_tbr, cpu_tmp0);
break;
case 6:
save_state(dc);
gen_helper_wrpstate(cpu_env, cpu_tmp0);
dc->npc = DYNAMIC_PC;
break;
case 7:
save_state(dc);
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, tl));
dc->npc = DYNAMIC_PC;
break;
case 8:
gen_helper_wrpil(cpu_env, cpu_tmp0);
break;
case 9:
gen_helper_wrcwp(cpu_env, cpu_tmp0);
break;
case 10:
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState,
cansave));
break;
case 11:
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState,
canrestore));
break;
case 12:
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState,
cleanwin));
break;
case 13:
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState,
otherwin));
break;
case 14:
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState,
wstate));
break;
case 16:
CHECK_IU_FEATURE(dc, GL);
tcg_gen_st32_tl(cpu_tmp0, cpu_env,
offsetof(CPUSPARCState, gl));
break;
case 26:
CHECK_IU_FEATURE(dc, HYPV);
if (!hypervisor(dc))
goto priv_insn;
tcg_gen_mov_tl(cpu_ssr, cpu_tmp0);
break;
default:
goto illegal_insn;
}
#else
tcg_gen_trunc_tl_i32(cpu_wim, cpu_tmp0);
if (dc->def->nwindows != 32) {
tcg_gen_andi_tl(cpu_wim, cpu_wim,
(1 << dc->def->nwindows) - 1);
}
#endif
}
break;
case 0x33:
{
#ifndef TARGET_SPARC64
if (!supervisor(dc))
goto priv_insn;
tcg_gen_xor_tl(cpu_tbr, cpu_src1, cpu_src2);
#else
CHECK_IU_FEATURE(dc, HYPV);
if (!hypervisor(dc))
goto priv_insn;
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
switch (rd) {
case 0:
gen_op_wrhpstate();
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
dc->is_br = 1;
break;
case 1:
gen_op_wrhtstate();
break;
case 3:
tcg_gen_mov_tl(cpu_hintp, cpu_tmp0);
break;
case 5:
tcg_gen_mov_tl(cpu_htba, cpu_tmp0);
break;
case 31:
{
TCGv_ptr r_tickptr;
tcg_gen_mov_tl(cpu_hstick_cmpr, cpu_tmp0);
r_tickptr = tcg_temp_new_ptr();
tcg_gen_ld_ptr(r_tickptr, cpu_env,
offsetof(CPUSPARCState, hstick));
gen_helper_tick_set_limit(r_tickptr,
cpu_hstick_cmpr);
tcg_temp_free_ptr(r_tickptr);
}
break;
case 6: readonly
default:
goto illegal_insn;
}
#endif
}
break;
#endif
#ifdef TARGET_SPARC64
case 0x2c:
{
int cc = GET_FIELD_SP(insn, 11, 12);
int cond = GET_FIELD_SP(insn, 14, 17);
DisasCompare cmp;
TCGv dst;
if (insn & (1 << 18)) {
if (cc == 0) {
gen_compare(&cmp, 0, cond, dc);
} else if (cc == 2) {
gen_compare(&cmp, 1, cond, dc);
} else {
goto illegal_insn;
}
} else {
gen_fcompare(&cmp, cc, cond);
}
if (IS_IMM) {
simm = GET_FIELD_SPs(insn, 0, 10);
tcg_gen_movi_tl(cpu_src2, simm);
}
dst = gen_load_gpr(dc, rd);
tcg_gen_movcond_tl(cmp.cond, dst,
cmp.c1, cmp.c2,
cpu_src2, dst);
free_compare(&cmp);
gen_store_gpr(dc, rd, dst);
break;
}
case 0x2d:
gen_helper_sdivx(cpu_dst, cpu_env, cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x2e:
gen_helper_popc(cpu_dst, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x2f:
{
int cond = GET_FIELD_SP(insn, 10, 12);
DisasCompare cmp;
TCGv dst;
gen_compare_reg(&cmp, cond, cpu_src1);
if (IS_IMM) {
simm = GET_FIELD_SPs(insn, 0, 9);
tcg_gen_movi_tl(cpu_src2, simm);
}
dst = gen_load_gpr(dc, rd);
tcg_gen_movcond_tl(cmp.cond, dst,
cmp.c1, cmp.c2,
cpu_src2, dst);
free_compare(&cmp);
gen_store_gpr(dc, rd, dst);
break;
}
#endif
default:
goto illegal_insn;
}
}
} else if (xop == 0x36) {
#ifdef TARGET_SPARC64
int opf = GET_FIELD_SP(insn, 5, 13);
rs1 = GET_FIELD(insn, 13, 17);
rs2 = GET_FIELD(insn, 27, 31);
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
switch (opf) {
case 0x000:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 1, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x001:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 0, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x002:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 1, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x003:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 0, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x004:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 1, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x005:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 0, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x006:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 1, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x007:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 0, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x008:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 1, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x009:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 0, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x00a:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 1, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x00b:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 0, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x010:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_helper_array8(cpu_dst, cpu_src1, cpu_src2);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x012:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_helper_array8(cpu_dst, cpu_src1, cpu_src2);
tcg_gen_shli_i64(cpu_dst, cpu_dst, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x014:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_helper_array8(cpu_dst, cpu_src1, cpu_src2);
tcg_gen_shli_i64(cpu_dst, cpu_dst, 2);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x018:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 0);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x01a:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 1);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x019:
CHECK_FPU_FEATURE(dc, VIS2);
cpu_src1 = gen_load_gpr(dc, rs1);
cpu_src2 = gen_load_gpr(dc, rs2);
tcg_gen_add_tl(cpu_dst, cpu_src1, cpu_src2);
tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, cpu_dst, 32, 32);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x020:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmple16(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x022:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmpne16(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x024:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmple32(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x026:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmpne32(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x028:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmpgt16(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x02a:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmpeq16(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x02c:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmpgt32(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x02e:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
cpu_src2_64 = gen_load_fpr_D(dc, rs2);
gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64);
gen_store_gpr(dc, rd, cpu_dst);
break;
case 0x031:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16);
break;
case 0x033:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16au);
break;
case 0x035:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16al);
break;
case 0x036:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8sux16);
break;
case 0x037:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8ulx16);
break;
case 0x038:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld8sux16);
break;
case 0x039:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld8ulx16);
break;
case 0x03a:
CHECK_FPU_FEATURE(dc, VIS1);
gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpack32);
break;
case 0x03b:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs2);
cpu_dst_32 = gen_dest_fpr_F(dc);
gen_helper_fpack16(cpu_dst_32, cpu_gsr, cpu_src1_64);
gen_store_fpr_F(dc, rd, cpu_dst_32);
break;
case 0x03d:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs2);
cpu_dst_32 = gen_dest_fpr_F(dc);
gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64);
gen_store_fpr_F(dc, rd, cpu_dst_32);
break;
case 0x03e:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDDD(dc, rd, rs1, rs2, gen_helper_pdist);
break;
case 0x048:
CHECK_FPU_FEATURE(dc, VIS1);
gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata);
break;
case 0x04b:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpmerge);
break;
case 0x04c:
CHECK_FPU_FEATURE(dc, VIS2);
gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_bshuffle);
break;
case 0x04d:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fexpand);
break;
case 0x050:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpadd16);
break;
case 0x051:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, gen_helper_fpadd16s);
break;
case 0x052:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpadd32);
break;
case 0x053:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_add_i32);
break;
case 0x054:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpsub16);
break;
case 0x055:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, gen_helper_fpsub16s);
break;
case 0x056:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpsub32);
break;
case 0x057:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_sub_i32);
break;
case 0x060:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_dst_64 = gen_dest_fpr_D(dc, rd);
tcg_gen_movi_i64(cpu_dst_64, 0);
gen_store_fpr_D(dc, rd, cpu_dst_64);
break;
case 0x061:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_dst_32 = gen_dest_fpr_F(dc);
tcg_gen_movi_i32(cpu_dst_32, 0);
gen_store_fpr_F(dc, rd, cpu_dst_32);
break;
case 0x062:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nor_i64);
break;
case 0x063:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_nor_i32);
break;
case 0x064:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_andc_i64);
break;
case 0x065:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_andc_i32);
break;
case 0x066:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DD(dc, rd, rs2, tcg_gen_not_i64);
break;
case 0x067:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FF(dc, rd, rs2, tcg_gen_not_i32);
break;
case 0x068:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64);
break;
case 0x069:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_andc_i32);
break;
case 0x06a:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DD(dc, rd, rs1, tcg_gen_not_i64);
break;
case 0x06b:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FF(dc, rd, rs1, tcg_gen_not_i32);
break;
case 0x06c:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64);
break;
case 0x06d:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_xor_i32);
break;
case 0x06e:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nand_i64);
break;
case 0x06f:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_nand_i32);
break;
case 0x070:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_and_i64);
break;
case 0x071:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_and_i32);
break;
case 0x072:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_eqv_i64);
break;
case 0x073:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_eqv_i32);
break;
case 0x074:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
gen_store_fpr_D(dc, rd, cpu_src1_64);
break;
case 0x075:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_32 = gen_load_fpr_F(dc, rs1);
gen_store_fpr_F(dc, rd, cpu_src1_32);
break;
case 0x076:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64);
break;
case 0x077:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_orc_i32);
break;
case 0x078:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_64 = gen_load_fpr_D(dc, rs2);
gen_store_fpr_D(dc, rd, cpu_src1_64);
break;
case 0x079:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_src1_32 = gen_load_fpr_F(dc, rs2);
gen_store_fpr_F(dc, rd, cpu_src1_32);
break;
case 0x07a:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64);
break;
case 0x07b:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_orc_i32);
break;
case 0x07c:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_or_i64);
break;
case 0x07d:
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_or_i32);
break;
case 0x07e:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_dst_64 = gen_dest_fpr_D(dc, rd);
tcg_gen_movi_i64(cpu_dst_64, -1);
gen_store_fpr_D(dc, rd, cpu_dst_64);
break;
case 0x07f:
CHECK_FPU_FEATURE(dc, VIS1);
cpu_dst_32 = gen_dest_fpr_F(dc);
tcg_gen_movi_i32(cpu_dst_32, -1);
gen_store_fpr_F(dc, rd, cpu_dst_32);
break;
case 0x080:
case 0x081:
goto illegal_insn;
default:
goto illegal_insn;
}
#else
goto ncp_insn;
#endif
} else if (xop == 0x37) {
#ifdef TARGET_SPARC64
goto illegal_insn;
#else
goto ncp_insn;
#endif
#ifdef TARGET_SPARC64
} else if (xop == 0x39) {
TCGv_i32 r_const;
save_state(dc);
cpu_src1 = get_src1(dc, insn);
if (IS_IMM) {
simm = GET_FIELDs(insn, 19, 31);
tcg_gen_addi_tl(cpu_tmp0, cpu_src1, simm);
} else {
rs2 = GET_FIELD(insn, 27, 31);
if (rs2) {
cpu_src2 = gen_load_gpr(dc, rs2);
tcg_gen_add_tl(cpu_tmp0, cpu_src1, cpu_src2);
} else {
tcg_gen_mov_tl(cpu_tmp0, cpu_src1);
}
}
gen_helper_restore(cpu_env);
gen_mov_pc_npc(dc);
r_const = tcg_const_i32(3);
gen_helper_check_align(cpu_env, cpu_tmp0, r_const);
tcg_temp_free_i32(r_const);
tcg_gen_mov_tl(cpu_npc, cpu_tmp0);
dc->npc = DYNAMIC_PC;
goto jmp_insn;
#endif
} else {
cpu_src1 = get_src1(dc, insn);
if (IS_IMM) {
simm = GET_FIELDs(insn, 19, 31);
tcg_gen_addi_tl(cpu_tmp0, cpu_src1, simm);
} else {
rs2 = GET_FIELD(insn, 27, 31);
if (rs2) {
cpu_src2 = gen_load_gpr(dc, rs2);
tcg_gen_add_tl(cpu_tmp0, cpu_src1, cpu_src2);
} else {
tcg_gen_mov_tl(cpu_tmp0, cpu_src1);
}
}
switch (xop) {
case 0x38:
{
TCGv t;
TCGv_i32 r_const;
t = gen_dest_gpr(dc, rd);
tcg_gen_movi_tl(t, dc->pc);
gen_store_gpr(dc, rd, t);
gen_mov_pc_npc(dc);
r_const = tcg_const_i32(3);
gen_helper_check_align(cpu_env, cpu_tmp0, r_const);
tcg_temp_free_i32(r_const);
gen_address_mask(dc, cpu_tmp0);
tcg_gen_mov_tl(cpu_npc, cpu_tmp0);
dc->npc = DYNAMIC_PC;
}
goto jmp_insn;
#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64)
case 0x39:
{
TCGv_i32 r_const;
if (!supervisor(dc))
goto priv_insn;
gen_mov_pc_npc(dc);
r_const = tcg_const_i32(3);
gen_helper_check_align(cpu_env, cpu_tmp0, r_const);
tcg_temp_free_i32(r_const);
tcg_gen_mov_tl(cpu_npc, cpu_tmp0);
dc->npc = DYNAMIC_PC;
gen_helper_rett(cpu_env);
}
goto jmp_insn;
#endif
case 0x3b:
if (!((dc)->def->features & CPU_FEATURE_FLUSH))
goto unimp_flush;
break;
case 0x3c:
save_state(dc);
gen_helper_save(cpu_env);
gen_store_gpr(dc, rd, cpu_tmp0);
break;
case 0x3d:
save_state(dc);
gen_helper_restore(cpu_env);
gen_store_gpr(dc, rd, cpu_tmp0);
break;
#if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64)
case 0x3e:
{
switch (rd) {
case 0:
if (!supervisor(dc))
goto priv_insn;
dc->npc = DYNAMIC_PC;
dc->pc = DYNAMIC_PC;
gen_helper_done(cpu_env);
goto jmp_insn;
case 1:
if (!supervisor(dc))
goto priv_insn;
dc->npc = DYNAMIC_PC;
dc->pc = DYNAMIC_PC;
gen_helper_retry(cpu_env);
goto jmp_insn;
default:
goto illegal_insn;
}
}
break;
#endif
default:
goto illegal_insn;
}
}
break;
}
break;
case 3:
{
unsigned int xop = GET_FIELD(insn, 7, 12);
TCGv cpu_addr = get_temp_tl(dc);
tcg_gen_mov_tl(cpu_addr, get_src1(dc, insn));
if (xop == 0x3c || xop == 0x3e) {
} else if (IS_IMM) {
simm = GET_FIELDs(insn, 19, 31);
if (simm != 0) {
tcg_gen_addi_tl(cpu_addr, cpu_addr, simm);
}
} else {
rs2 = GET_FIELD(insn, 27, 31);
if (rs2 != 0) {
tcg_gen_add_tl(cpu_addr, cpu_addr, gen_load_gpr(dc, rs2));
}
}
if (xop < 4 || (xop > 7 && xop < 0x14 && xop != 0x0e) ||
(xop > 0x17 && xop <= 0x1d ) ||
(xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) {
TCGv cpu_val = gen_dest_gpr(dc, rd);
switch (xop) {
case 0x0:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld32u(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x1:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld8u(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x2:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld16u(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x3:
if (rd & 1)
goto illegal_insn;
else {
TCGv_i32 r_const;
TCGv_i64 t64;
save_state(dc);
r_const = tcg_const_i32(7);
gen_helper_check_align(cpu_env, cpu_addr, r_const);
tcg_temp_free_i32(r_const);
gen_address_mask(dc, cpu_addr);
t64 = tcg_temp_new_i64();
tcg_gen_qemu_ld64(t64, cpu_addr, dc->mem_idx);
tcg_gen_trunc_i64_tl(cpu_tmp0, t64);
tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0xffffffffULL);
gen_store_gpr(dc, rd + 1, cpu_tmp0);
tcg_gen_shri_i64(t64, t64, 32);
tcg_gen_trunc_i64_tl(cpu_val, t64);
tcg_temp_free_i64(t64);
tcg_gen_andi_tl(cpu_val, cpu_val, 0xffffffffULL);
}
break;
case 0x9:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld8s(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0xa:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld16s(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0xd:
{
TCGv r_const;
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld8s(cpu_val, cpu_addr, dc->mem_idx);
r_const = tcg_const_tl(0xff);
tcg_gen_qemu_st8(r_const, cpu_addr, dc->mem_idx);
tcg_temp_free(r_const);
}
break;
case 0x0f:
CHECK_IU_FEATURE(dc, SWAP);
cpu_src1 = gen_load_gpr(dc, rd);
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld32u(cpu_tmp0, cpu_addr, dc->mem_idx);
tcg_gen_qemu_st32(cpu_src1, cpu_addr, dc->mem_idx);
tcg_gen_mov_tl(cpu_val, cpu_tmp0);
break;
#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64)
case 0x10:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 4, 0);
break;
case 0x11:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 1, 0);
break;
case 0x12:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 2, 0);
break;
case 0x13:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
if (rd & 1)
goto illegal_insn;
save_state(dc);
gen_ldda_asi(dc, cpu_val, cpu_addr, insn, rd);
goto skip_move;
case 0x19:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 1, 1);
break;
case 0x1a:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 2, 1);
break;
case 0x1d:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_ldstub_asi(cpu_val, cpu_addr, insn);
break;
case 0x1f:
CHECK_IU_FEATURE(dc, SWAP);
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
cpu_src1 = gen_load_gpr(dc, rd);
gen_swap_asi(cpu_val, cpu_src1, cpu_addr, insn);
break;
#ifndef TARGET_SPARC64
case 0x30:
case 0x31:
case 0x33:
goto ncp_insn;
#endif
#endif
#ifdef TARGET_SPARC64
case 0x08:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld32s(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x0b:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld64(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x18:
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 4, 1);
break;
case 0x1b:
save_state(dc);
gen_ld_asi(cpu_val, cpu_addr, insn, 8, 0);
break;
case 0x2d:
goto skip_move;
case 0x30:
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
save_state(dc);
gen_ldf_asi(cpu_addr, insn, 4, rd);
gen_update_fprs_dirty(rd);
goto skip_move;
case 0x33:
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
save_state(dc);
gen_ldf_asi(cpu_addr, insn, 8, DFPREG(rd));
gen_update_fprs_dirty(DFPREG(rd));
goto skip_move;
case 0x3d:
goto skip_move;
case 0x32:
CHECK_FPU_FEATURE(dc, FLOAT128);
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
save_state(dc);
gen_ldf_asi(cpu_addr, insn, 16, QFPREG(rd));
gen_update_fprs_dirty(QFPREG(rd));
goto skip_move;
#endif
default:
goto illegal_insn;
}
gen_store_gpr(dc, rd, cpu_val);
#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64)
skip_move: ;
#endif
} else if (xop >= 0x20 && xop < 0x24) {
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
save_state(dc);
switch (xop) {
case 0x20:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_ld32u(cpu_tmp0, cpu_addr, dc->mem_idx);
cpu_dst_32 = gen_dest_fpr_F(dc);
tcg_gen_trunc_tl_i32(cpu_dst_32, cpu_tmp0);
gen_store_fpr_F(dc, rd, cpu_dst_32);
break;
case 0x21:
#ifdef TARGET_SPARC64
gen_address_mask(dc, cpu_addr);
if (rd == 1) {
TCGv_i64 t64 = tcg_temp_new_i64();
tcg_gen_qemu_ld64(t64, cpu_addr, dc->mem_idx);
gen_helper_ldxfsr(cpu_env, t64);
tcg_temp_free_i64(t64);
break;
}
#endif
{
TCGv_i32 t32 = get_temp_i32(dc);
tcg_gen_qemu_ld32u(cpu_tmp0, cpu_addr, dc->mem_idx);
tcg_gen_trunc_tl_i32(t32, cpu_tmp0);
gen_helper_ldfsr(cpu_env, t32);
}
break;
case 0x22:
{
TCGv_i32 r_const;
CHECK_FPU_FEATURE(dc, FLOAT128);
r_const = tcg_const_i32(dc->mem_idx);
gen_address_mask(dc, cpu_addr);
gen_helper_ldqf(cpu_env, cpu_addr, r_const);
tcg_temp_free_i32(r_const);
gen_op_store_QT0_fpr(QFPREG(rd));
gen_update_fprs_dirty(QFPREG(rd));
}
break;
case 0x23:
gen_address_mask(dc, cpu_addr);
cpu_dst_64 = gen_dest_fpr_D(dc, rd);
tcg_gen_qemu_ld64(cpu_dst_64, cpu_addr, dc->mem_idx);
gen_store_fpr_D(dc, rd, cpu_dst_64);
break;
default:
goto illegal_insn;
}
} else if (xop < 8 || (xop >= 0x14 && xop < 0x18) ||
xop == 0xe || xop == 0x1e) {
TCGv cpu_val = gen_load_gpr(dc, rd);
switch (xop) {
case 0x4:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_st32(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x5:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_st8(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x6:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_st16(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x7:
if (rd & 1)
goto illegal_insn;
else {
TCGv_i32 r_const;
TCGv_i64 t64;
TCGv lo;
save_state(dc);
gen_address_mask(dc, cpu_addr);
r_const = tcg_const_i32(7);
gen_helper_check_align(cpu_env, cpu_addr, r_const);
tcg_temp_free_i32(r_const);
lo = gen_load_gpr(dc, rd + 1);
t64 = tcg_temp_new_i64();
tcg_gen_concat_tl_i64(t64, lo, cpu_val);
tcg_gen_qemu_st64(t64, cpu_addr, dc->mem_idx);
tcg_temp_free_i64(t64);
}
break;
#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64)
case 0x14:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_st_asi(cpu_val, cpu_addr, insn, 4);
dc->npc = DYNAMIC_PC;
break;
case 0x15:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_st_asi(cpu_val, cpu_addr, insn, 1);
dc->npc = DYNAMIC_PC;
break;
case 0x16:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
save_state(dc);
gen_st_asi(cpu_val, cpu_addr, insn, 2);
dc->npc = DYNAMIC_PC;
break;
case 0x17:
#ifndef TARGET_SPARC64
if (IS_IMM)
goto illegal_insn;
if (!supervisor(dc))
goto priv_insn;
#endif
if (rd & 1)
goto illegal_insn;
else {
save_state(dc);
gen_stda_asi(dc, cpu_val, cpu_addr, insn, rd);
}
break;
#endif
#ifdef TARGET_SPARC64
case 0x0e:
gen_address_mask(dc, cpu_addr);
tcg_gen_qemu_st64(cpu_val, cpu_addr, dc->mem_idx);
break;
case 0x1e:
save_state(dc);
gen_st_asi(cpu_val, cpu_addr, insn, 8);
dc->npc = DYNAMIC_PC;
break;
#endif
default:
goto illegal_insn;
}
} else if (xop > 0x23 && xop < 0x28) {
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
save_state(dc);
switch (xop) {
case 0x24:
gen_address_mask(dc, cpu_addr);
cpu_src1_32 = gen_load_fpr_F(dc, rd);
tcg_gen_ext_i32_tl(cpu_tmp0, cpu_src1_32);
tcg_gen_qemu_st32(cpu_tmp0, cpu_addr, dc->mem_idx);
break;
case 0x25:
{
TCGv t = get_temp_tl(dc);
tcg_gen_ld_tl(t, cpu_env, offsetof(CPUSPARCState, fsr));
#ifdef TARGET_SPARC64
gen_address_mask(dc, cpu_addr);
if (rd == 1) {
tcg_gen_qemu_st64(t, cpu_addr, dc->mem_idx);
break;
}
#endif
tcg_gen_qemu_st32(t, cpu_addr, dc->mem_idx);
}
break;
case 0x26:
#ifdef TARGET_SPARC64
{
TCGv_i32 r_const;
CHECK_FPU_FEATURE(dc, FLOAT128);
gen_op_load_fpr_QT0(QFPREG(rd));
r_const = tcg_const_i32(dc->mem_idx);
gen_address_mask(dc, cpu_addr);
gen_helper_stqf(cpu_env, cpu_addr, r_const);
tcg_temp_free_i32(r_const);
}
break;
#else
#if defined(CONFIG_USER_ONLY)
goto illegal_insn;
#else
if (!supervisor(dc))
goto priv_insn;
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
goto nfq_insn;
#endif
#endif
case 0x27:
gen_address_mask(dc, cpu_addr);
cpu_src1_64 = gen_load_fpr_D(dc, rd);
tcg_gen_qemu_st64(cpu_src1_64, cpu_addr, dc->mem_idx);
break;
default:
goto illegal_insn;
}
} else if (xop > 0x33 && xop < 0x3f) {
save_state(dc);
switch (xop) {
#ifdef TARGET_SPARC64
case 0x34:
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
gen_stf_asi(cpu_addr, insn, 4, rd);
break;
case 0x36:
{
TCGv_i32 r_const;
CHECK_FPU_FEATURE(dc, FLOAT128);
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
r_const = tcg_const_i32(7);
gen_helper_check_align(cpu_env, cpu_addr, r_const);
tcg_temp_free_i32(r_const);
gen_stf_asi(cpu_addr, insn, 16, QFPREG(rd));
}
break;
case 0x37:
if (gen_trap_ifnofpu(dc)) {
goto jmp_insn;
}
gen_stf_asi(cpu_addr, insn, 8, DFPREG(rd));
break;
case 0x3c:
rs2 = GET_FIELD(insn, 27, 31);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_cas_asi(dc, cpu_addr, cpu_src2, insn, rd);
break;
case 0x3e:
rs2 = GET_FIELD(insn, 27, 31);
cpu_src2 = gen_load_gpr(dc, rs2);
gen_casx_asi(dc, cpu_addr, cpu_src2, insn, rd);
break;
#else
case 0x34:
case 0x35:
case 0x36:
case 0x37:
goto ncp_insn;
#endif
default:
goto illegal_insn;
}
} else {
goto illegal_insn;
}
}
break;
}
if (dc->npc == DYNAMIC_PC) {
dc->pc = DYNAMIC_PC;
gen_op_next_insn();
} else if (dc->npc == JUMP_PC) {
gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond);
dc->is_br = 1;
} else {
dc->pc = dc->npc;
dc->npc = dc->npc + 4;
}
jmp_insn:
goto egress;
illegal_insn:
{
TCGv_i32 r_const;
save_state(dc);
r_const = tcg_const_i32(TT_ILL_INSN);
gen_helper_raise_exception(cpu_env, r_const);
tcg_temp_free_i32(r_const);
dc->is_br = 1;
}
goto egress;
unimp_flush:
{
TCGv_i32 r_const;
save_state(dc);
r_const = tcg_const_i32(TT_UNIMP_FLUSH);
gen_helper_raise_exception(cpu_env, r_const);
tcg_temp_free_i32(r_const);
dc->is_br = 1;
}
goto egress;
#if !defined(CONFIG_USER_ONLY)
priv_insn:
{
TCGv_i32 r_const;
save_state(dc);
r_const = tcg_const_i32(TT_PRIV_INSN);
gen_helper_raise_exception(cpu_env, r_const);
tcg_temp_free_i32(r_const);
dc->is_br = 1;
}
goto egress;
#endif
nfpu_insn:
save_state(dc);
gen_op_fpexception_im(FSR_FTT_UNIMPFPOP);
dc->is_br = 1;
goto egress;
#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64)
nfq_insn:
save_state(dc);
gen_op_fpexception_im(FSR_FTT_SEQ_ERROR);
dc->is_br = 1;
goto egress;
#endif
#ifndef TARGET_SPARC64
ncp_insn:
{
TCGv r_const;
save_state(dc);
r_const = tcg_const_i32(TT_NCP_INSN);
gen_helper_raise_exception(cpu_env, r_const);
tcg_temp_free(r_const);
dc->is_br = 1;
}
goto egress;
#endif
egress:
if (dc->n_t32 != 0) {
int i;
for (i = dc->n_t32 - 1; i >= 0; --i) {
tcg_temp_free_i32(dc->t32[i]);
}
dc->n_t32 = 0;
}
if (dc->n_ttl != 0) {
int i;
for (i = dc->n_ttl - 1; i >= 0; --i) {
tcg_temp_free(dc->ttl[i]);
}
dc->n_ttl = 0;
}
}
| 1threat
|
Better to animate in code or in animation software for website? : <p>So I want to add a animated spinning globe to my 'about' section on my website. Basically, I have a vector image of a globe that I created, I want it to spin a few times, then have a pin drop on my city.
So, i'd want to add some motion graphics to show the spinning, the content on the globe would 'smear' and then the pin and whatever else. How would one implement this into a website?
Better to code the animation?
Gifs? </p>
<p>Thanks so much in advance!</p>
| 0debug
|
calling delegate method on Ibaction : i unable to call
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
on IBaction
- (IBAction)button:(UIButton *)sender {
}
help me
| 0debug
|
def access_elements(nums, list_index):
result = [nums[i] for i in list_index]
return result
| 0debug
|
What does `--oom-kill-disable` do for a Docker container? : <p>I have understood that <code>docker run -m 256m --memory-swap 256m</code> will limit a container so that it can use at most 256 MB of memory and no swap. If it allocates more, then a process in the container (not "the container") will be killed. For example:</p>
<pre><code>$ sudo docker run -it --rm -m 256m --memory-swap 256m \
stress --vm 1 --vm-bytes 2000M --vm-hang 0
stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
stress: FAIL: [1] (415) <-- worker 7 got signal 9
stress: WARN: [1] (417) now reaping child worker processes
stress: FAIL: [1] (421) kill error: No such process
stress: FAIL: [1] (451) failed run completed in 1s
</code></pre>
<p>Apparently one of the workers allocates more memory than is allowed and receives a <code>SIGKILL</code>. Note that the parent process stays alive.</p>
<p>Now if the effect of <code>-m</code> is to invoke the OOM killer if a process allocates too much memory, then what happens when specifying <code>-m</code> <em>and</em> <code>--oom-kill-disable</code>? Trying it like above has the following result:</p>
<pre><code>$ sudo docker run -it --rm -m 256m --memory-swap 256m --oom-kill-disable \
stress --vm 1 --vm-bytes 2000M --vm-hang 0
stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
(waits here)
</code></pre>
<p>In a different shell:</p>
<pre><code>$ docker stats
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
f5e4c30d75c9 0.00% 256 MiB / 256 MiB 100.00% 0 B / 508 B 0 B / 0 B 2
$ top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19391 root 20 0 2055904 262352 340 D 0.0 0.1 0:00.05 stress
</code></pre>
<p>I see the <code>docker stats</code> shows a memory consumption of 256 MB, and <code>top</code> shows a <code>RES</code> of 256 MB and a <code>VIRT</code> of 2000 MB. But, what does that actually mean? What will happen to a process inside the container that tries to use more memory than allowed? In which sense it is constrained by <code>-m</code>?</p>
| 0debug
|
static void smbios_build_type_0_fields(QemuOpts *opts)
{
const char *val;
unsigned char major, minor;
val = qemu_opt_get(opts, "vendor");
if (val) {
smbios_add_field(0, offsetof(struct smbios_type_0, vendor_str),
val, strlen(val) + 1);
}
val = qemu_opt_get(opts, "version");
if (val) {
smbios_add_field(0, offsetof(struct smbios_type_0, bios_version_str),
val, strlen(val) + 1);
}
val = qemu_opt_get(opts, "date");
if (val) {
smbios_add_field(0, offsetof(struct smbios_type_0,
bios_release_date_str),
val, strlen(val) + 1);
}
val = qemu_opt_get(opts, "release");
if (val) {
if (sscanf(val, "%hhu.%hhu", &major, &minor) != 2) {
error_report("Invalid release");
exit(1);
}
smbios_add_field(0, offsetof(struct smbios_type_0,
system_bios_major_release),
&major, 1);
smbios_add_field(0, offsetof(struct smbios_type_0,
system_bios_minor_release),
&minor, 1);
}
}
| 1threat
|
Best practice for storing ASP.NET Core Authorization claims when authenticating users against Active Directory? : <p>I am creating an enterprise intranet ASP.NET Core MVC application. I want my users to authenticate using Active Directory and I want user authorizations (claims) stored in <em>ApplicationDbContext</em>.</p>
<p>I assume that I need to use <em>Microsoft.AspNetCore.Identity</em> and <em>Microsoft.AspNetCore.Identity.EntityFrameworkCore</em> to accomplish my goals. What is the best practice for storing ASP.NET Core Authorization claims when authenticating against Active Directory?</p>
<p>The following code will give me access to the current windows user security context (current logged in user), from within the pipeline. Somehow I need to map the user with associated <em>Microsoft.AspNetCore.Identity</em> claims?</p>
<pre><code> app.Use(async (context, next) =>
{
var identity = (ClaimsIdentity) context.User.Identity;
await next.Invoke();
});
</code></pre>
<p>Thanks in advance for the help!</p>
| 0debug
|
static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
uint32_t length, AVFrame *p)
{
int ret;
size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
if (!(s->state & PNG_IHDR)) {
av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
return AVERROR_INVALIDDATA;
}
if (!(s->state & PNG_IDAT)) {
avctx->width = s->width;
avctx->height = s->height;
s->channels = ff_png_get_nb_channels(s->color_type);
s->bits_per_pixel = s->bit_depth * s->channels;
s->bpp = (s->bits_per_pixel + 7) >> 3;
s->row_size = (s->cur_w * s->bits_per_pixel + 7) >> 3;
if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) &&
s->color_type == PNG_COLOR_TYPE_RGB) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) &&
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_RGBA;
} else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_RGBA64BE;
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1 && avctx->codec_id != AV_CODEC_ID_APNG) {
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_YA8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_YA16BE;
} else {
av_log(avctx, AV_LOG_ERROR, "unsupported bit depth %d "
"and color type %d\n",
s->bit_depth, s->color_type);
return AVERROR_INVALIDDATA;
}
if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) {
switch (avctx->pix_fmt) {
case AV_PIX_FMT_RGB24:
avctx->pix_fmt = AV_PIX_FMT_RGBA;
break;
case AV_PIX_FMT_RGB48BE:
avctx->pix_fmt = AV_PIX_FMT_RGBA64BE;
break;
case AV_PIX_FMT_GRAY8:
avctx->pix_fmt = AV_PIX_FMT_YA8;
break;
case AV_PIX_FMT_GRAY16BE:
avctx->pix_fmt = AV_PIX_FMT_YA16BE;
break;
default:
avpriv_request_sample(avctx, "bit depth %d "
"and color type %d with TRNS",
s->bit_depth, s->color_type);
return AVERROR_INVALIDDATA;
}
s->bpp += byte_depth;
}
if ((ret = ff_thread_get_buffer(avctx, &s->picture, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
if (avctx->codec_id == AV_CODEC_ID_APNG && s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
ff_thread_release_buffer(avctx, &s->previous_picture);
if ((ret = ff_thread_get_buffer(avctx, &s->previous_picture, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
}
ff_thread_finish_setup(avctx);
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->interlaced_frame = !!s->interlace_type;
if (!s->interlace_type) {
s->crow_size = s->row_size + 1;
} else {
s->pass = 0;
s->pass_row_size = ff_png_pass_row_size(s->pass,
s->bits_per_pixel,
s->cur_w);
s->crow_size = s->pass_row_size + 1;
}
ff_dlog(avctx, "row_size=%d crow_size =%d\n",
s->row_size, s->crow_size);
s->image_buf = p->data[0];
s->image_linesize = p->linesize[0];
if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t));
av_fast_padded_mallocz(&s->last_row, &s->last_row_size, s->row_size);
if (!s->last_row)
return AVERROR_INVALIDDATA;
if (s->interlace_type ||
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
av_fast_padded_malloc(&s->tmp_row, &s->tmp_row_size, s->row_size);
if (!s->tmp_row)
return AVERROR_INVALIDDATA;
}
av_fast_padded_malloc(&s->buffer, &s->buffer_size, s->row_size + 16);
if (!s->buffer)
return AVERROR(ENOMEM);
s->crow_buf = s->buffer + 15;
s->zstream.avail_out = s->crow_size;
s->zstream.next_out = s->crow_buf;
}
s->state |= PNG_IDAT;
if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE)
s->bpp -= byte_depth;
ret = png_decode_idat(s, length);
if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE)
s->bpp += byte_depth;
if (ret < 0)
return ret;
bytestream2_skip(&s->gb, 4);
return 0;
}
| 1threat
|
In phone number validation 9,10,14 digit numbers should be valid,if number start with + then any digit number should be valid : <p>In my phone number validation i need to validate only 9,10,14 digit numbers and 11,12,13 numbers are not valid,if phone number start with + then any digit number should be valid.Any preg_match code available? please help. :(</p>
| 0debug
|
function call returns NaN when all types are correct : <p>A function call keeps returning NaN, when taken out of context it works but in context it doesn't</p>
<p>I've tried changing types between double and Double to no avail</p>
<pre><code>private Double average(ArrayList<Double> x){
Double sum = 0.0;
for(int i = 0; i < x.size(); i++)
sum += x.get(i);
return sum / x.size();
}
</code></pre>
<p>the return is NaN in most cases</p>
| 0debug
|
I want that when I select a city of a state, then all the detials of that city are visible : <p>I want that when I select a city of a state, then all the detials of that city are not visible. how to visible it on select city.</p>
<p>I want that when I select a city of a state, then all the detials of that city are visible.</p>
| 0debug
|
Excel - VBA: want to split a folder with large number of files : I am in a strange situation... I get a large number of files (XML or Excel)... I store it in a folder.
But, I need to split it into smaller batches and give it to my team members, so that they can work on those files.
So, I want to create a Macro that can split the folder (for example 1000 files) into about 10 folders with 100 files in each of them.
Is this possible? could you please guide me.
Thanks,
| 0debug
|
static void vnc_tight_start(VncState *vs)
{
buffer_reset(&vs->tight);
vs->tight_tmp = vs->output;
vs->output = vs->tight;
}
| 1threat
|
datetime.datetime is not JSON serializable : <p>I have a class in Python for retrieving all the columns in a table and return a JSON with this data.</p>
<p>The problem is at least one of those columns is a datetime and I can't seem to understand how to serialize the columns so I can generate a valid JSON.</p>
<p>My class is as follows:</p>
<pre><code>class GetTodos(Resource):
def get(self):
con = cx_Oracle.connect('brunojs/bdpf5@127.0.0.1/orcl')
cur = con.cursor()
cur.execute("select * from organite_repository")
r = [dict((cur.description[i][0], value) \
for i, value in enumerate(row)) for row in cur.fetchall()]
cur.connection.close()
return (r[0] if r else None) if None else r
</code></pre>
<p>Any hints on this?</p>
| 0debug
|
int register_savevm_live(DeviceState *dev,
const char *idstr,
int instance_id,
int version_id,
SaveVMHandlers *ops,
void *opaque)
{
SaveStateEntry *se;
se = g_malloc0(sizeof(SaveStateEntry));
se->version_id = version_id;
se->section_id = savevm_state.global_section_id++;
se->ops = ops;
se->opaque = opaque;
se->vmsd = NULL;
if (ops->save_live_setup != NULL) {
se->is_ram = 1;
}
if (dev) {
char *id = qdev_get_dev_path(dev);
if (id) {
pstrcpy(se->idstr, sizeof(se->idstr), id);
pstrcat(se->idstr, sizeof(se->idstr), "/");
g_free(id);
se->compat = g_malloc0(sizeof(CompatEntry));
pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), idstr);
se->compat->instance_id = instance_id == -1 ?
calculate_compat_instance_id(idstr) : instance_id;
instance_id = -1;
}
}
pstrcat(se->idstr, sizeof(se->idstr), idstr);
if (instance_id == -1) {
se->instance_id = calculate_new_instance_id(se->idstr);
} else {
se->instance_id = instance_id;
}
assert(!se->compat || se->instance_id == 0);
QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);
return 0;
}
| 1threat
|
cover fit the inner image of slant div : <p>I need to create a slope/angled element, so I tried <code>skew()</code> transform. Inside this element I have an image which I want to cover the whole area of parent element, but when I applied <code>skew()</code> to image to make it straight, the image is not fully covered. I know I can use <code>scale()</code> transform to cover the image but thats blur my image. What I am looking for is below image.</p>
<p><a href="https://i.stack.imgur.com/0xkdP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0xkdP.png" alt="enter image description here"></a></p>
<p>Is there any another way to do this?</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>* {
box-sizing: border-box;
margin: 0;
}
.container {
display: flex;
overflow: hidden;
flex-wrap: wrap;
margin: 0 -30px;
}
.container a {
border: 3px solid;
transform: skew(-30deg);
width: 20%;
overflow: hidden;
}
.container img {
max-width: 100%;
display: block;
transform: skew(30deg);
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container">
<a href=""><img src="http://via.placeholder.com/350x150"></a>
<a href=""><img src="http://via.placeholder.com/350x150"></a>
<a href=""><img src="http://via.placeholder.com/350x150"></a>
<a href=""><img src="http://via.placeholder.com/350x150"></a>
<a href=""><img src="http://via.placeholder.com/350x150"></a>
</div></code></pre>
</div>
</div>
</p>
| 0debug
|
static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
MpegEncContext * const s = &h->s;
int i, j;
int current_ref_assigned=0;
Picture *pic;
if((s->avctx->debug&FF_DEBUG_MMCO) && mmco_count==0)
av_log(h->s.avctx, AV_LOG_DEBUG, "no mmco here\n");
for(i=0; i<mmco_count; i++){
int structure, frame_num, unref_pic;
if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_pic_num, h->mmco[i].long_arg);
switch(mmco[i].opcode){
case MMCO_SHORT2UNUSED:
if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count);
frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure);
pic = find_short(h, frame_num, &j);
if (pic) {
if (unreference_pic(h, pic, structure ^ PICT_FRAME))
remove_short_at_index(h, j);
} else if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short failure\n");
case MMCO_SHORT2LONG:
if (FIELD_PICTURE && mmco[i].long_arg < h->long_ref_count &&
h->long_ref[mmco[i].long_arg]->frame_num ==
mmco[i].short_pic_num / 2) {
int frame_num = mmco[i].short_pic_num >> FIELD_PICTURE;
pic= remove_long(h, mmco[i].long_arg);
if(pic) unreference_pic(h, pic, 0);
h->long_ref[ mmco[i].long_arg ]= remove_short(h, frame_num);
if (h->long_ref[ mmco[i].long_arg ]){
h->long_ref[ mmco[i].long_arg ]->long_ref=1;
h->long_ref_count++;
case MMCO_LONG2UNUSED:
j = pic_num_extract(h, mmco[i].long_arg, &structure);
pic = h->long_ref[j];
if (pic) {
if (unreference_pic(h, pic, structure ^ PICT_FRAME))
remove_long_at_index(h, j);
} else if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref long failure\n");
case MMCO_LONG:
unref_pic = 1;
if (FIELD_PICTURE && !s->first_field) {
if (h->long_ref[mmco[i].long_arg] == s->current_picture_ptr) {
unref_pic = 0;
} else if (s->current_picture_ptr->reference) {
s->current_picture_ptr->reference = PICT_FRAME;
} else if (s->current_picture_ptr->long_ref) {
av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term reference "
"assignment for second field "
"in complementary field pair "
"(first field is long term)\n");
/*
* First field in reference, but not in any sensible place on our
* reference lists. This shouldn't happen unless reference
* handling somewhere else is wrong.
assert(0);
current_ref_assigned = 1;
if(!current_ref_assigned){
pic= remove_short(h, s->current_picture_ptr->frame_num);
if(pic){
unreference_pic(h, pic, 0);
av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n");
if(h->short_ref_count)
memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count*sizeof(Picture*));
h->short_ref[0]= s->current_picture_ptr;
h->short_ref[0]->long_ref=0;
h->short_ref_count++;
s->current_picture_ptr->reference |= s->picture_structure;
print_short_term(h);
print_long_term(h);
return 0;
| 1threat
|
What this this shell script do? : Please help me understand what does this shell script do:
# main
for HOST in ${HOSTS}
do
URI=http://${HOST}:80
count=99
result=`/opt/splunk/bin/splunk search "index=${INDEX} sourcetype=${SOURCETYPE} SPLUNK_HEALTH_CHECK |stats count" -earliest_time ${EARLIEST} -latest_time ${LATEST} -uri ${URI} -auth ${USER}:${PASS} -preview F -output csv -timeout ${TIMEOUT} 2>&1 |grep -v count |tr -d '\n' |sed 's/"//g'`
if expr $result : '[0-9]*' > /dev/null 2>&1; then
count=$result
result="OK"
fi
date +"%Y-%m-%d %T sh=${HOST} status=\"${result}\" delay_status=$count"
done
while calling this script from splunk, i get the following error:
status="Could not look up HOME variable. Auth tokens cannot be cached.10" delay_status=99
| 0debug
|
Show hidden images on website : <p>How to see hidden images on this javascript game. This is timing memory game, and uses javascript to hide images after 2 clicks. Is there any extension or any way in console to edit the script to not hide images.
<a href="https://apps.pixel.mk/kviz-bimilk/memorija.php" rel="nofollow">https://apps.pixel.mk/kviz-bimilk/memorija.php</a> </p>
| 0debug
|
Making C++ Pi approximation running in Paralell on GPU Nvidia 970M CUDA's : <p>I got this code from The Chudnovsky formula for Pi approximation and I want to do it faster and faster. But I have no experience or idea of how to deal with GPU's. How to make this code runs on GPU Nvidea 970M? It's on C++. There's some easy lib to make it? With my processor it's running about 3~4s... </p>
<pre><code>#include <iostream>
#include <windows>
#include <iomanip>
#include <cmath>
double fac(double num) {
double result = 1.0;
for (double i=2.0; i<num; i++)
result *= i;
return result;
}
int main() {
using namespace std;
double pi=0.0;
for (double k = 0.0; k < 10.0; k++) {
pi += (pow(-1.0,k) * fac(6.0 * k) * (13591409.0 + (545140134.0 * k)))
/ (fac(3.0 * k) * pow(fac(k), 3.0) * pow(640320.0, 3.0 * k + 3.0/2.0));
}
pi *= 12.0;
cout << setprecision(100000000) << 1.0 / pi << endl;
system("Pause");
return 0;
}
</code></pre>
| 0debug
|
SQL Query result to Java Array : <p>I want to read the query result in to array and want to check the array in if condition.
Query in returns </p>
<pre><code>SELECT COLUMN
FROM Table;
OUT PUT:
A
B
C
D
F
</code></pre>
<p>Want to store the above result in array in java and use in the if condition.</p>
| 0debug
|
Make a part of UILabel clickable : <p>Hi Im new to swift and Im trying to have a part of UILabel open up a link in browser.I have created label in storyboard and type as attributed.Im sure how to make it clikable in the most easiest way possible. Also some time there are multiple links for different words but all are part of same label.</p>
| 0debug
|
webpack, sass, react-css-modules - ReferenceError window is not defined : <p>I'm using webpack and React with react-css-modules and scss files. When i try and build it gives me an error on every file that imports scss files - </p>
<pre><code>ERROR in ./app/components/Buttons/Button.scss
Module build failed: ReferenceError: window is not defined
</code></pre>
<p>I have googled for a solid day and a half and have got no where! Please help!</p>
<p>Here's my webpack set up: </p>
<pre><code>var webpack = require('webpack');
var PROD = (process.env.NODE_ENV === 'production');
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/app/index.html',
filename: 'index.html',
inject: 'body'
});
module.exports = {
entry: [
'./app/index.jsx'
],
output: {
path: __dirname + '/dist',
filename: PROD ? 'bundle.min.js' : 'bundle.js'
},
watchOptions: {
poll: true
},
module: {
preLoaders: [
{
test: /\.jsx$|\.js$/,
loader: 'eslint-loader',
include: __dirname + '/assets',
exclude: /bundle\.js$/
}
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', ['style!css?sourceMap&localIdentName=[local]___[hash:base64:5]!resolve-url!sass?outputStyle=expanded'])
}
]
},
postcss: [autoprefixer({ browsers: ['last 2 versions'] })],
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: PROD ? [
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
})
] : [
HTMLWebpackPluginConfig,
new ExtractTextPlugin("styles.css", {
allChunks: true
})
]
};
</code></pre>
<p>Thanks in advance!</p>
| 0debug
|
WHY Isnt my for loop for my leap year program not working : so our assignment is to make a for loop program and while loop program out of our switch statement program, so i just need to know why my for loop program isnt running and if you want to check my while too , that would be great
while loop:
/*
* File: main.cpp
* Author: Jorge Elias
*
* Created on October 22, 2017, 11:53 PM
*/
#include<cstdlib>
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
/*
*
*/
int main( ) {
//Assigning the Integers
int month,days,year;
//Asking User for inputs
cout<<"Please enter the Year: ";cin>>year;
cout<<"Please enter the month (1-12): ";cin>>month;
//Switch statement to determine how many days there are in a month
switch(month) {
case 1:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 10:
case 12:
cout<<"31 days"<<endl;
break;
case 9:
case 11:
cout<<"30 days"<<endl;
break;
while(month<0){
cout<<"INVALID INPUT! Please enter month number between 1-12"<<endl;
break;
}
//Determine if the Year inputed by the User is a Leap Year or not
case 2:
while(year>0){
if(year % 100 == 0 && year % 400 == 0)
{
cout<<"This is a leap year, 29 days"<<endl;
}
else if( year % 100 !=0 && year % 4 == 0)
{
cout<<"This is a leap year, 29 days"<<endl;
}
else
cout<<"there are 28 days";
break;
}
}
return 0;
}
for loop:
*
* File: main.cpp
* Author: Jorge Elias
*
* Created on October 22, 2017, 11:53 PM
*/
#include<cstdlib>
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
/*
*
*/
int main( ) {
//Assigning the Integers
int month,days,year;
//Asking User for inputs
cout<<"Please enter the Year: ";cin>>year;
cout<<"Please enter the month (1-12): ";cin>>month;
//Switch statement to determine how many days there are in a month
for(month>1; month<12;){
switch(month) {
case 1:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 10:
case 12:
cout<<"31 days"<<endl;
break;
case 9:
case 11:
cout<<"30 days"<<endl;
break;
for(month<1;month>12;){
cout<<"INVALID INPUT! Please enter month number between 1-12"<<endl;
break;
}
//Determine if the Year inputed by the User is a Leap Year or not
case 2:
for(year % 100 == 0;year % 400 == 0;)
{
cout<<"This is a leap year, 29 days"<<endl;
for( year % 100 !=0; year % 4 == 0;)
{
cout<<"This is a leap year, 29 days"<<endl;
}
for(year >0;)
{
cout<<"there are 28 days";
break;
}
}
}
}
return 0;
}
| 0debug
|
Public field from String - How can you get a public field vis its name(string) : <p>So in a class (ImportantClass123) I have this:</p>
<pre><code>public AnotherImportantClass aReallyImportantClass;
</code></pre>
<p>How do I return</p>
<pre><code>AnotherImportantClass
</code></pre>
<p>via knowledge of what its named as a field:</p>
<pre><code>aReallyImportantClass
</code></pre>
<p>Something like </p>
<pre><code>ImportantClass123.getFieldWithName("aReallyImportantClass");
</code></pre>
<p>?</p>
<p>How would I write getFieldWithName? and what would be its return type? Class?</p>
| 0debug
|
static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *gb)
{
MpegEncContext *s = &ctx->m;
int a = 2 << s->sprite_warping_accuracy;
int rho = 3 - s->sprite_warping_accuracy;
int r = 16 / a;
int alpha = 0;
int beta = 0;
int w = s->width;
int h = s->height;
int min_ab, i, w2, h2, w3, h3;
int sprite_ref[4][2];
int virtual_ref[2][2];
const int vop_ref[4][2] = { { 0, 0 }, { s->width, 0 },
{ 0, s->height }, { s->width, s->height } };
int d[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
if (w <= 0 || h <= 0)
return AVERROR_INVALIDDATA;
for (i = 0; i < ctx->num_sprite_warping_points; i++) {
int length;
int x = 0, y = 0;
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
if (length > 0)
x = get_xbits(gb, length);
if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
check_marker(s->avctx, gb, "before sprite_trajectory");
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
if (length > 0)
y = get_xbits(gb, length);
check_marker(s->avctx, gb, "after sprite_trajectory");
ctx->sprite_traj[i][0] = d[i][0] = x;
ctx->sprite_traj[i][1] = d[i][1] = y;
for (; i < 4; i++)
ctx->sprite_traj[i][0] = ctx->sprite_traj[i][1] = 0;
while ((1 << alpha) < w)
alpha++;
while ((1 << beta) < h)
beta++;
w2 = 1 << alpha;
h2 = 1 << beta;
if (ctx->divx_version == 500 && ctx->divx_build == 413) {
sprite_ref[0][0] = a * vop_ref[0][0] + d[0][0];
sprite_ref[0][1] = a * vop_ref[0][1] + d[0][1];
sprite_ref[1][0] = a * vop_ref[1][0] + d[0][0] + d[1][0];
sprite_ref[1][1] = a * vop_ref[1][1] + d[0][1] + d[1][1];
sprite_ref[2][0] = a * vop_ref[2][0] + d[0][0] + d[2][0];
sprite_ref[2][1] = a * vop_ref[2][1] + d[0][1] + d[2][1];
} else {
sprite_ref[0][0] = (a >> 1) * (2 * vop_ref[0][0] + d[0][0]);
sprite_ref[0][1] = (a >> 1) * (2 * vop_ref[0][1] + d[0][1]);
sprite_ref[1][0] = (a >> 1) * (2 * vop_ref[1][0] + d[0][0] + d[1][0]);
sprite_ref[1][1] = (a >> 1) * (2 * vop_ref[1][1] + d[0][1] + d[1][1]);
sprite_ref[2][0] = (a >> 1) * (2 * vop_ref[2][0] + d[0][0] + d[2][0]);
sprite_ref[2][1] = (a >> 1) * (2 * vop_ref[2][1] + d[0][1] + d[2][1]);
virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2) +
ROUNDED_DIV(((w - w2) *
(r * sprite_ref[0][0] - 16 * vop_ref[0][0]) +
w2 * (r * sprite_ref[1][0] - 16 * vop_ref[1][0])), w);
virtual_ref[0][1] = 16 * vop_ref[0][1] +
ROUNDED_DIV(((w - w2) *
(r * sprite_ref[0][1] - 16 * vop_ref[0][1]) +
w2 * (r * sprite_ref[1][1] - 16 * vop_ref[1][1])), w);
virtual_ref[1][0] = 16 * vop_ref[0][0] +
ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16 * vop_ref[0][0]) +
h2 * (r * sprite_ref[2][0] - 16 * vop_ref[2][0])), h);
virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2) +
ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) +
h2 * (r * sprite_ref[2][1] - 16 * vop_ref[2][1])), h);
switch (ctx->num_sprite_warping_points) {
case 0:
s->sprite_offset[0][0] =
s->sprite_offset[0][1] =
s->sprite_offset[1][0] =
s->sprite_offset[1][1] = 0;
s->sprite_delta[0][0] = a;
s->sprite_delta[0][1] =
s->sprite_delta[1][0] = 0;
s->sprite_delta[1][1] = a;
ctx->sprite_shift[0] =
ctx->sprite_shift[1] = 0;
break;
case 1:
s->sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0];
s->sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1];
s->sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) -
a * (vop_ref[0][0] / 2);
s->sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
a * (vop_ref[0][1] / 2);
s->sprite_delta[0][0] = a;
s->sprite_delta[0][1] =
s->sprite_delta[1][0] = 0;
s->sprite_delta[1][1] = a;
ctx->sprite_shift[0] =
ctx->sprite_shift[1] = 0;
break;
case 2:
s->sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + rho)) +
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
(-vop_ref[0][0]) +
(r * sprite_ref[0][1] - virtual_ref[0][1]) *
(-vop_ref[0][1]) + (1 << (alpha + rho - 1));
s->sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + rho)) +
(-r * sprite_ref[0][1] + virtual_ref[0][1]) *
(-vop_ref[0][0]) +
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
(-vop_ref[0][1]) + (1 << (alpha + rho - 1));
s->sprite_offset[1][0] = ((-r * sprite_ref[0][0] + virtual_ref[0][0]) *
(-2 * vop_ref[0][0] + 1) +
(r * sprite_ref[0][1] - virtual_ref[0][1]) *
(-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
sprite_ref[0][0] - 16 * w2 + (1 << (alpha + rho + 1)));
s->sprite_offset[1][1] = ((-r * sprite_ref[0][1] + virtual_ref[0][1]) *
(-2 * vop_ref[0][0] + 1) +
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
(-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
sprite_ref[0][1] - 16 * w2 + (1 << (alpha + rho + 1)));
s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
s->sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]);
s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]);
s->sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
ctx->sprite_shift[0] = alpha + rho;
ctx->sprite_shift[1] = alpha + rho + 2;
break;
case 3:
min_ab = FFMIN(alpha, beta);
w3 = w2 >> min_ab;
h3 = h2 >> min_ab;
s->sprite_offset[0][0] = (sprite_ref[0][0] * (1<<(alpha + beta + rho - min_ab))) +
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
h3 * (-vop_ref[0][0]) +
(-r * sprite_ref[0][0] + virtual_ref[1][0]) *
w3 * (-vop_ref[0][1]) +
(1 << (alpha + beta + rho - min_ab - 1));
s->sprite_offset[0][1] = (sprite_ref[0][1] * (1 << (alpha + beta + rho - min_ab))) +
(-r * sprite_ref[0][1] + virtual_ref[0][1]) *
h3 * (-vop_ref[0][0]) +
(-r * sprite_ref[0][1] + virtual_ref[1][1]) *
w3 * (-vop_ref[0][1]) +
(1 << (alpha + beta + rho - min_ab - 1));
s->sprite_offset[1][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
h3 * (-2 * vop_ref[0][0] + 1) +
(-r * sprite_ref[0][0] + virtual_ref[1][0]) *
w3 * (-2 * vop_ref[0][1] + 1) + 2 * w2 * h3 *
r * sprite_ref[0][0] - 16 * w2 * h3 +
(1 << (alpha + beta + rho - min_ab + 1));
s->sprite_offset[1][1] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) *
h3 * (-2 * vop_ref[0][0] + 1) +
(-r * sprite_ref[0][1] + virtual_ref[1][1]) *
w3 * (-2 * vop_ref[0][1] + 1) + 2 * w2 * h3 *
r * sprite_ref[0][1] - 16 * w2 * h3 +
(1 << (alpha + beta + rho - min_ab + 1));
s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3;
s->sprite_delta[0][1] = (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3;
s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3;
s->sprite_delta[1][1] = (-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3;
ctx->sprite_shift[0] = alpha + beta + rho - min_ab;
ctx->sprite_shift[1] = alpha + beta + rho - min_ab + 2;
break;
if (s->sprite_delta[0][0] == a << ctx->sprite_shift[0] &&
s->sprite_delta[0][1] == 0 &&
s->sprite_delta[1][0] == 0 &&
s->sprite_delta[1][1] == a << ctx->sprite_shift[0]) {
s->sprite_offset[0][0] >>= ctx->sprite_shift[0];
s->sprite_offset[0][1] >>= ctx->sprite_shift[0];
s->sprite_offset[1][0] >>= ctx->sprite_shift[1];
s->sprite_offset[1][1] >>= ctx->sprite_shift[1];
s->sprite_delta[0][0] = a;
s->sprite_delta[0][1] = 0;
s->sprite_delta[1][0] = 0;
s->sprite_delta[1][1] = a;
ctx->sprite_shift[0] = 0;
ctx->sprite_shift[1] = 0;
s->real_sprite_warping_points = 1;
} else {
int shift_y = 16 - ctx->sprite_shift[0];
int shift_c = 16 - ctx->sprite_shift[1];
if (shift_c < 0 || shift_y < 0 ||
FFABS(s->sprite_offset[0][0]) >= INT_MAX >> shift_y ||
FFABS(s->sprite_offset[1][0]) >= INT_MAX >> shift_c ||
FFABS(s->sprite_offset[0][1]) >= INT_MAX >> shift_y ||
FFABS(s->sprite_offset[1][1]) >= INT_MAX >> shift_c
) {
avpriv_request_sample(s->avctx, "Too large sprite shift or offset");
for (i = 0; i < 2; i++) {
s->sprite_offset[0][i] *= 1 << shift_y;
s->sprite_offset[1][i] *= 1 << shift_c;
s->sprite_delta[0][i] *= 1 << shift_y;
s->sprite_delta[1][i] *= 1 << shift_y;
ctx->sprite_shift[i] = 16;
s->real_sprite_warping_points = ctx->num_sprite_warping_points;
return 0;
| 1threat
|
static int nbd_handle_reply_err(uint32_t opt, uint32_t type, Error **errp)
{
if (!(type & (1 << 31))) {
return 0;
}
switch (type) {
case NBD_REP_ERR_UNSUP:
error_setg(errp, "Unsupported option type %x", opt);
break;
case NBD_REP_ERR_POLICY:
error_setg(errp, "Denied by server for option %x", opt);
break;
case NBD_REP_ERR_INVALID:
error_setg(errp, "Invalid data length for option %x", opt);
break;
case NBD_REP_ERR_TLS_REQD:
error_setg(errp, "TLS negotiation required before option %x", opt);
break;
default:
error_setg(errp, "Unknown error code when asking for option %x", opt);
break;
}
return -1;
}
| 1threat
|
Could not autowire field:RestTemplate in Spring boot application : <p>I am getting below exception while running spring boot application during start up:</p>
<pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.client.RestTemplate com.micro.test.controller.TestController.restTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
</code></pre>
<p>I am autowiring RestTemplate in my TestController. I am using Maven for dependency managagement.</p>
<p><strong>TestMicroServiceApplication.java</strong></p>
<pre><code>package com.micro.test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TestMicroServiceApplication {
public static void main(String[] args) {
SpringApplication.run(TestMicroServiceApplication.class, args);
}
}
</code></pre>
<p><strong>TestController.java</strong></p>
<pre><code> package com.micro.test.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RestController
public class TestController {
@Autowired
private RestTemplate restTemplate;
@RequestMapping(value="/micro/order/{id}",
method=RequestMethod.GET,
produces=MediaType.ALL_VALUE)
public String placeOrder(@PathVariable("id") int customerId){
System.out.println("Hit ===> PlaceOrder");
Object[] customerJson = restTemplate.getForObject("http://localhost:8080/micro/customers", Object[].class);
System.out.println(customerJson.toString());
return "false";
}
}
</code></pre>
<p><strong>POM.xml</strong></p>
<pre><code> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.micro.test</groupId>
<artifactId>Test-MicroService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test-MicroService</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
</code></pre>
| 0debug
|
static void tcg_out_setcond2(TCGContext *s, const TCGArg *args,
const int *const_args)
{
TCGArg new_args[6];
int label_true, label_over;
memcpy(new_args, args+1, 5*sizeof(TCGArg));
if (args[0] == args[1] || args[0] == args[2]
|| (!const_args[3] && args[0] == args[3])
|| (!const_args[4] && args[0] == args[4])) {
label_true = label_arg(gen_new_label());
label_over = label_arg(gen_new_label());
new_args[5] = label_true;
tcg_out_brcond2(s, new_args, const_args+1, 1);
tcg_out_movi(s, TCG_TYPE_I32, args[0], 0);
tcg_out_jxx(s, JCC_JMP, label_over, 1);
tcg_out_label(s, label_true, s->code_ptr);
tcg_out_movi(s, TCG_TYPE_I32, args[0], 1);
tcg_out_label(s, label_over, s->code_ptr);
} else {
tcg_out_movi(s, TCG_TYPE_I32, args[0], 0);
label_over = label_arg(gen_new_label());
new_args[4] = tcg_invert_cond(new_args[4]);
new_args[5] = label_over;
tcg_out_brcond2(s, new_args, const_args+1, 1);
tgen_arithi(s, ARITH_ADD, args[0], 1, 0);
tcg_out_label(s, label_over, s->code_ptr);
}
}
| 1threat
|
need to remove a scroll on mobile view : mobile view of website allows me to scroll to the right when it shouldnt allow it to happen.
@media screen and (max-width:768px){
body{
overflow-x: hidden;
width: 100%;
}
.nav-links{
position: absolute;
right:0px;
height: 92vh;
top: 8vh;
background-color: #4A4F52;
display: flex;
flex-direction: column;
align-items: center;
transform: translateX(100%);
transition: transform 0.5s ease-in;
z-index: -1;
}
.nav-links li{
opacity: 0;
}
.burger{
display: block;
cursor: pointer;
}
}
.nav-active{
transform: translateX(0%);
z-index: 1;
width: 100%;
height: 100%;
}
Hi all,
I am building a website and i have a new bar thats working greating in terms of sliding across from the right hand side, shoing the menus etc. however when on mobile i can scroll my screen across and see part of the back ground for the nav bar. I have tried the "overfloe-x:hidden" approach on the body and html elementsand that hasn't worked. i have tried various solutions mentioned in old posts on stackoverflow. is there anything any could suggest ?
If anything else is needed just let me know and i can post it.
| 0debug
|
How to run a script for all files in Linux directory? : <p>New to Linux here, sorry for the (easy?) question:</p>
<p>I have a script in Linux called script_run that works fine if I run it once and manually designate filenames. The script reads an input file, interpolates the data, and then saves the interpolated data to an output file. I'd like the output file to have the same name, except with a "_interp" added. I want to automate the script to run for all files in the file folder directory. How do I do this? My attempt is below, and I am running the script in the file folder directory, but it fails to loop. Thank you for your help! </p>
<pre><code>FILEFOLDER=$*
for FILES in $FILEFOLDER
do
script_run "
[--input ${FILES}]
[WriterStd --output tmp_output_${FILES}.txt]"
cat tmp_output_${FILES}.txt >> output_${FILES}_interp.txt
done
</code></pre>
| 0debug
|
Is React Native's LayoutAnimation supported on Android? : <p>I do not see <a href="https://facebook.github.io/react-native/docs/layoutanimation.html" rel="noreferrer">anything in the documentation</a> referring to lack of support for Android. I'm using a simple preset animation:</p>
<p><code>LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);</code></p>
<p>It works in iOS, but in Android it makes the transition without any spring animation.</p>
| 0debug
|
How to initialize HashSet values by construction for Double? : <p>I am following link : <a href="https://stackoverflow.com/questions/2041778/how-to-initialize-hashset-values-by-construction?newreg=dcfb635715de40c4aee35a851fc103fd">How to initialize HashSet values by construction?</a> and could be very silly question to ask, but I didn't make it working, please guide.</p>
<pre><code>public class Demo {
public static void main(String[] args) {
Set<Double> tempSet = new HashSet<Double>();
tempSet.add(11.0);
tempSet.add(22.0);
// Below both lines not working
Set<Double> tempSet1 = new HashSet<Double>({11.0, 22.0});
Set<Double> tempSet1 = new HashSet<Double>(){11.0, 22.0};
}
}
</code></pre>
| 0debug
|
static void decode_ac_filter(WmallDecodeCtx *s)
{
int i;
s->acfilter_order = get_bits(&s->gb, 4) + 1;
s->acfilter_scaling = get_bits(&s->gb, 4);
for(i = 0; i < s->acfilter_order; i++) {
s->acfilter_coeffs[i] = get_bits(&s->gb, s->acfilter_scaling) + 1;
}
}
| 1threat
|
How onStart() is calling after onCreate() method? : I am learning about design patterns in java. In Android, every time I read that, first Oncreate() is called and next onStart() and then onResume() called . How they are calling internally ? Which design pattern they are using ? How these Callback functions are implemented ? were they used observer pattern or interfaces or abstract classes ? How onStart() is calling after onCreate() method ?
I read the source code, But I didn't understand. Please explain me once
How onStart() is calling after onCreate() function and which design pattern ? Please give suggestions, How should I read source code ?
| 0debug
|
How to calculate GMT Time based on Local time in C : <p>I have a linx based system where we cannot specify timezone of the time being set. So whoever sets time on this device sets their localtime. Now I have a requirement where I need to calculate the GMT Time based on the localtime that was existing on the device. </p>
<p>I guess I need to be taking the input of timezone the user is located in some variable. For Example timezone = EST-5:00EDT which means the local time is 5 hours behind the GMT Time. </p>
<p>Now do we have any functions in standard C Library which will calculate the GMT Time for me when I pass the offset. </p>
<p>Any help in this regard is highly appreciated. I searched through web and all I could find is only these functions in the below link:
<a href="http://linux.die.net/man/3/localtime_r" rel="nofollow">http://linux.die.net/man/3/localtime_r</a>. I could not find any function which can calculate the time based on offset. </p>
<p>Is there any other approach to handle this. </p>
| 0debug
|
static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRMachineState *spapr,
uint32_t token, uint32_t nargs,
target_ulong args, uint32_t nret,
target_ulong rets)
{
uint32_t config_addr = rtas_ld(args, 0);
uint64_t buid = rtas_ldq(args, 1);
unsigned int func = rtas_ld(args, 3);
unsigned int req_num = rtas_ld(args, 4);
unsigned int seq_num = rtas_ld(args, 5);
unsigned int ret_intr_type;
unsigned int irq, max_irqs = 0;
sPAPRPHBState *phb = NULL;
PCIDevice *pdev = NULL;
spapr_pci_msi *msi;
int *config_addr_key;
switch (func) {
case RTAS_CHANGE_MSI_FN:
case RTAS_CHANGE_FN:
ret_intr_type = RTAS_TYPE_MSI;
break;
case RTAS_CHANGE_MSIX_FN:
ret_intr_type = RTAS_TYPE_MSIX;
break;
default:
error_report("rtas_ibm_change_msi(%u) is not implemented", func);
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
return;
}
phb = spapr_pci_find_phb(spapr, buid);
if (phb) {
pdev = spapr_pci_find_dev(spapr, buid, config_addr);
}
if (!phb || !pdev) {
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
return;
}
if (!req_num) {
msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);
if (!msi) {
trace_spapr_pci_msi("Releasing wrong config", config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
return;
}
xics_free(spapr->icp, msi->first_irq, msi->num);
if (msi_present(pdev)) {
spapr_msi_setmsg(pdev, 0, false, 0, 0);
}
if (msix_present(pdev)) {
spapr_msi_setmsg(pdev, 0, true, 0, 0);
}
g_hash_table_remove(phb->msi, &config_addr);
trace_spapr_pci_msi("Released MSIs", config_addr);
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
rtas_st(rets, 1, 0);
return;
}
if (ret_intr_type == RTAS_TYPE_MSI) {
max_irqs = msi_nr_vectors_allocated(pdev);
} else if (ret_intr_type == RTAS_TYPE_MSIX) {
max_irqs = pdev->msix_entries_nr;
}
if (!max_irqs) {
error_report("Requested interrupt type %d is not enabled for device %x",
ret_intr_type, config_addr);
rtas_st(rets, 0, -1);
return;
}
if (req_num > max_irqs) {
trace_spapr_pci_msi_retry(config_addr, req_num, max_irqs);
req_num = max_irqs;
irq = 0;
goto out;
}
irq = xics_alloc_block(spapr->icp, 0, req_num, false,
ret_intr_type == RTAS_TYPE_MSI);
if (!irq) {
error_report("Cannot allocate MSIs for device %x", config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
return;
}
spapr_msi_setmsg(pdev, SPAPR_PCI_MSI_WINDOW, ret_intr_type == RTAS_TYPE_MSIX,
irq, req_num);
msi = g_new(spapr_pci_msi, 1);
msi->first_irq = irq;
msi->num = req_num;
config_addr_key = g_new(int, 1);
*config_addr_key = config_addr;
g_hash_table_insert(phb->msi, config_addr_key, msi);
out:
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
rtas_st(rets, 1, req_num);
rtas_st(rets, 2, ++seq_num);
if (nret > 3) {
rtas_st(rets, 3, ret_intr_type);
}
trace_spapr_pci_rtas_ibm_change_msi(config_addr, func, req_num, irq);
}
| 1threat
|
How to set teh selected option on a dropdown list on a jquery dialog? : i have a table od data, when i sent the a row of data to fields on a jquery dialog it fails to set the selected value of the `dropdown list`
i have use this
$('#ddlProducts').val(data.prodID);
`data.prodID` has a value but it does not set it to the `value` of the `dropdown`. How do i fix this?
| 0debug
|
static void stream_desc_load(struct Stream *s, hwaddr addr)
{
struct SDesc *d = &s->desc;
int i;
cpu_physical_memory_read(addr, (void *) d, sizeof *d);
d->buffer_address = le64_to_cpu(d->buffer_address);
d->nxtdesc = le64_to_cpu(d->nxtdesc);
d->control = le32_to_cpu(d->control);
d->status = le32_to_cpu(d->status);
for (i = 0; i < ARRAY_SIZE(d->app); i++) {
d->app[i] = le32_to_cpu(d->app[i]);
}
}
| 1threat
|
How to understand defensive copy : <p>I simply understand defensive copy is that: when a instance of class is created. Using defensive copy make sure clients won't change the internal of that instance.Am i right ? If not, please tell me How to understand defensive copy. </p>
| 0debug
|
Doble for loop in Python : #my inner for loop is not using new values from outer loop, any help please
import numpy as np
a = 0.0000001
b = 15.
d = 0.1
TOL = 1.0e-6
a1 = []
dd = 0.1
da1 = []
for i in range(0,10):
def f(v):
return np.cosh(d * v) - (1./v) * np.sinh(d * v) - 1.
FA = f(a)
FB = f(b)
for I in range(0,1000):
p = a + (b - a) / 2.0
FP = f(p)
if FA == 0 or (b - a)/2.0 < TOL:
break
I = I + 1
if FA * FP > 0:
a = p
FA = FP
if FA * FP < 0:
b = p
a1.append(p)
da1.append(d)
d = d + dd
print a1
print da1
| 0debug
|
static int vnc_display_get_addresses(QemuOpts *opts,
bool reverse,
SocketAddress ***retsaddr,
size_t *retnsaddr,
SocketAddress ***retwsaddr,
size_t *retnwsaddr,
Error **errp)
{
SocketAddress *saddr = NULL;
SocketAddress *wsaddr = NULL;
QemuOptsIter addriter;
const char *addr;
int to = qemu_opt_get_number(opts, "to", 0);
bool has_ipv4 = qemu_opt_get(opts, "ipv4");
bool has_ipv6 = qemu_opt_get(opts, "ipv6");
bool ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
bool ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
size_t i;
int displaynum = -1;
int ret = -1;
*retsaddr = NULL;
*retnsaddr = 0;
*retwsaddr = NULL;
*retnwsaddr = 0;
addr = qemu_opt_get(opts, "vnc");
if (addr == NULL || g_str_equal(addr, "none")) {
ret = 0;
goto cleanup;
}
if (qemu_opt_get(opts, "websocket") &&
!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) {
error_setg(errp,
"SHA1 hash support is required for websockets");
goto cleanup;
}
qemu_opt_iter_init(&addriter, opts, "vnc");
while ((addr = qemu_opt_iter_next(&addriter)) != NULL) {
int rv;
rv = vnc_display_get_address(addr, false, reverse, 0, to,
has_ipv4, has_ipv6,
ipv4, ipv6,
&saddr, errp);
if (rv < 0) {
goto cleanup;
}
if (displaynum == -1) {
displaynum = rv;
}
*retsaddr = g_renew(SocketAddress *, *retsaddr, *retnsaddr + 1);
(*retsaddr)[(*retnsaddr)++] = saddr;
}
if (*retnsaddr > 1) {
displaynum = -1;
}
qemu_opt_iter_init(&addriter, opts, "websocket");
while ((addr = qemu_opt_iter_next(&addriter)) != NULL) {
if (vnc_display_get_address(addr, true, reverse, displaynum, to,
has_ipv4, has_ipv6,
ipv4, ipv6,
&wsaddr, errp) < 0) {
goto cleanup;
}
if (*retnsaddr == 1 &&
(*retsaddr)[0]->type == SOCKET_ADDRESS_KIND_INET &&
wsaddr->type == SOCKET_ADDRESS_KIND_INET &&
g_str_equal(wsaddr->u.inet.data->host, "") &&
!g_str_equal((*retsaddr)[0]->u.inet.data->host, "")) {
g_free(wsaddr->u.inet.data->host);
wsaddr->u.inet.data->host =
g_strdup((*retsaddr)[0]->u.inet.data->host);
}
*retwsaddr = g_renew(SocketAddress *, *retwsaddr, *retnwsaddr + 1);
(*retwsaddr)[(*retnwsaddr)++] = wsaddr;
}
ret = 0;
cleanup:
if (ret < 0) {
for (i = 0; i < *retnsaddr; i++) {
qapi_free_SocketAddress((*retsaddr)[i]);
}
g_free(*retsaddr);
for (i = 0; i < *retnwsaddr; i++) {
qapi_free_SocketAddress((*retwsaddr)[i]);
}
g_free(*retwsaddr);
*retsaddr = *retwsaddr = NULL;
*retnsaddr = *retnwsaddr = 0;
}
return ret;
}
| 1threat
|
sql query to fetch details when one of value is missing : Consider a table with entries student
cloumn1 column2 column3
john age 23
john salary 100
John rollno 12
Raj age 24
Raj rollno 10
here I want to get result of salary value when queried on salary and student
name
It is always quried on salary and student...for the second student since salary record itself is not there ..I am facing the issue in fetching the records
request every one to throw your solutions
thanks in advance
| 0debug
|
Unused variable 'frame' : <p>Does that make sense frame is not used on <a href="https://github.com/hivinau/material-components-ios/blob/develop/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m" rel="nofollow noreferrer">https://github.com/hivinau/material-components-ios/blob/develop/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m</a> (line 51) ?</p>
| 0debug
|
How works table[index]+=1 in this code?And why index is +=2,+=1:This is an example in Eloquent Javascript : function tableFor(event, journal) {
let table = [0, 0, 0, 0];
for (let i = 0; i < journal.length; i++) {
let entry = journal[i], index = 0;
if (entry.events.includes(event)) index += 1;
if (entry.squirrel) index += 2;
table[index] += 1;
}
return table;
}
console.log(tableFor("pizza", JOURNAL));
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.