我有问题.这是我的代码:
var method = new DynamicMethod("dummy", null, Type.EmptyTypes);
var g = method.GetILGenerator();
g.DeclareLocal(typeof(int));
Label inequality = g.DefineLabel();
Label equality = g.DefineLabel();
Label end = g.DefineLabel();
g.Emit(OpCodes.Ldstr, "string");
g.Emit(OpCodes.Ldstr, "string");
g.Emit(OpCodes.Call, typeof(String).GetMethod("op_Equality", new Type[]{typeof(string), typeof(string)}));
g.Emit(OpCodes.Stloc_0);
g.Emit(OpCodes.Ldloc_0);
g.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[]{typeof(int)}));
g.Emit(OpCodes.Ldloc_0);
g.Emit(OpCodes.Ldc_I4_1);
g.Emit(OpCodes.Ceq);
g.Emit(OpCodes.Brtrue_S, equality);
g.Emit(OpCodes.Brfalse_S, inequality);
g.MarkLabel(inequality);
g.Emit(OpCodes.Ldstr, "Specified strings are different.");
g.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[]{typeof(string)}));
g.Emit(OpCodes.Br_S, end);
g.MarkLabel(equality);
g.Emit(OpCodes.Ldstr, "Specified strings are same.");
g.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) }));
g.Emit(OpCodes.Br_S, end);
g.MarkLabel(end);
g.Emit(OpCodes.Ret);
var action = (Action)method.CreateDelegate(typeof(Action)); …Run Code Online (Sandbox Code Playgroud) c# reflection if-statement reflection.emit system.reflection
在NASM汇编器中,可以使用.前缀声明本地标签。
我问是因为有些功能使我感到困惑。这是一个示例代码:
ORG 0x400000 ;origin of address for labels
start: ;address here should be 0x400000
..... ;some code here
.loop ;local label
..... ;some code here
jmp short .loop ;<------- address is not taken as absolute
jmp short start
Run Code Online (Sandbox Code Playgroud)
如果我使用一些普通标签(如start)进行引用,并将其与lea指令一起使用,则地址将被视为相对于原点的普通绝对地址。
short(如最后一行所示),会发生什么情况?是否从绝对地址计算出跳转的偏移量?我之所以这么问,是因为我的代码中有本地标签(.LNXYZ,是随机生成的),并且需要列出地址列表(从这些标签中),该地址列表将包含4字节的元素,其中包含用于跳转的绝对地址。这样有可能吗,还是我必须使用普通标签?有任何指令吗?
FilterOutputStreamJava中的实际用法是什么?来自javadocs:
此类是过滤输出流的所有类的超类.这些流位于已存在的输出流(基础输出流)之上,它将其用作数据的基本接收器,但可能沿途转换数据或提供其他功能.
对我来说,似乎有相同的方法OutputStream(可能由于某种原因覆盖它们?).它提供了什么样的数据"转换"以及什么时候可以在自己的Java应用程序中使用它?
我通过Reflection.Emit生成一个带有静态字段num1,num2等的Type.
现在我不知道如何发出代码,将生成的类型中的静态字段的内容加载到静态方法的评估堆栈中.到目前为止我尝试过的是:
generator.Emit(Opcodes.Ldarg, 0);
generator.Emit(Opcodes.Ldfld, "num1");
Run Code Online (Sandbox Code Playgroud)
但显然这不起作用,因为它试图在'this'上加载一个实例字段,而不提供给静态方法.
我应该使用哪种操作码来访问静态字段?
我知道这个问题似乎是平庸的,但我的问题很小.我正在尝试匹配类似于此的输入:
%!: Word Word=888 Word=AAA
Run Code Online (Sandbox Code Playgroud)
...使用这个正则表达式:
[A-Za-z]*
Run Code Online (Sandbox Code Playgroud)
我只需要选择第一个单词whitch 只包含字符.我的C#代码:
string res = Regex.Match("[A-Za-z]*", this.Content, RegexOptions.Singleline).Value;
Run Code Online (Sandbox Code Playgroud)
请帮我.它不适合我.
我正在使用套接字。这是我的代码(对问题的描述更进一步):
客户端:
public void ReadCallback(IAsyncResult ar)
{
int fileNameLen = 1;
String content = String.Empty;
StateObject state = (StateObject)ar.AsyncState;
Socket handler = state.workSocket;
int bytesRead = handler.EndReceive(ar);
if (bytesRead > 0)
{
if (flag == 0)
{
fileNameLen = BitConverter.ToInt32(state.buffer, 0);
string fileName = Encoding.UTF8.GetString(state.buffer, 4, fileNameLen);
receivedPath = mypath + @"XML\";
if (!Directory.Exists(receivedPath))
{
Directory.CreateDirectory(receivedPath);
}
receivedPath = receivedPath + fileName;
flag++;
}
if (flag >= 1)
{
BinaryWriter writer = new BinaryWriter(File.Open(receivedPath, FileMode.Append));
if (flag == 1) …Run Code Online (Sandbox Code Playgroud) 在这些日子里,我正在尝试研究JVM字节码.我发现FNEG在维基百科上描述了操作码:use to negate a float.到底有什么好处呢?我试图在普通Java代码中对变量进行否定,Eclipse报告错误,即对于float类型的参数,否定运算符是未定义的.那有什么用呢?我怎么用呢?
我已经着手说明何时我需要将IEEE-754单精度和双精度数字转换成带有基数的字符串10.有FXTRACT可用的指令,但它只为基数2提供指数和尾数,因为数字计算公式为:
value = (-1)^sign * 1.(mantissa) * 2^(exponent-bias)
Run Code Online (Sandbox Code Playgroud)
如果我有特定基数的对数指令,我将能够改变2 指数的基数-表达式中的偏差部分,但目前我不知道该怎么做.我也在考虑使用标准的舍入转换为整数,但它似乎无法使用,因为它不提供精确的转换.有人知道这样做的方法/基本原则是什么?请帮忙.
我终于找到了另一个解决方案(用Java编写)
{
/* handling -infinity, +infinity and NaN, returns "" if 'f' isn't one of mentioned */
String ret = "";
if ((ret = getSpecialFloats(f)).length() != 0)
return ret;
}
int num = Float.toRawIntBits(f);
int exponent = (int)(((num >> 23) & 0xFF)-127); //8bits, bias 127
int mantissa = num & 0x7FFFFF; //23bits
/* stores decimal exponent */
int decimalExponent = …Run Code Online (Sandbox Code Playgroud) string floating-point assembly ieee-754 floating-point-precision
我有这个代码:
>>> import socket
>>> sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sck.connect(('loaclhost', 2525))
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
Run Code Online (Sandbox Code Playgroud)Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> sck.connect(('localhost', 2526)) socket.error: [Errno 10061] No connection could be made because目标机器积极拒绝它
请帮帮我 哪里可以出错?我该怎么修呢?
我的SQL代码有点小问题:
UPDATE articles SET like=like+1 WHERE id=1
Run Code Online (Sandbox Code Playgroud)
当我尝试在PhpMyAdmin中执行它时,我收到此错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like=like+1 WHERE id=1' at line 1
Run Code Online (Sandbox Code Playgroud)
列类似于int默认设置为0(长度为11).有谁知道我该如何修理它?请帮忙.
32位处理器上的物理地址扩展是否需要36位地址总线?如果我使用位于具有36位地址的页面中的32位地址怎么办?
我想询问是否可以将服务器配置为使用.asp扩展文件,就像使用ASP.NET页面一样.或者绝对否认不将新代码与旧ASP混合使用?
c# ×5
assembly ×3
java ×2
sockets ×2
x86 ×2
.net ×1
asp-classic ×1
asp.net ×1
bus ×1
bytecode ×1
ieee-754 ×1
if-statement ×1
iis ×1
il ×1
ilasm ×1
increment ×1
input ×1
jvm ×1
match ×1
mysql ×1
nasm ×1
output ×1
outputstream ×1
php ×1
python ×1
python-3.x ×1
reflection ×1
regex ×1
sql ×1
stream ×1
string ×1
text ×1