gpt4 book ai didi

reverse - 将 else 语句复制到 if 语句

转载 作者:行者123 更新时间:2023-12-02 04:03:38 25 4
gpt4 key购买 nike

我正在尝试将 else 状态的代码复制到 if 语句。在这里我看到 if-eqz 作为 if 条件,但我不知道 else 条件在哪里。有人可以帮我找到 else 条件,以便我可以将其复制为 if 代码吗?

我也想知道else语句体的开始和结束位置在哪里

if-eqz v1, :cond_1

.line 103
:goto_1
return-object v0

.line 82
:cond_0
invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

move-result-object v0

invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

move-result-object v0

.line 83
new-instance v2, Ljava/lang/StringBuilder;

invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v0

const-string v2, "/Android/data/"

invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v0

sget-object v2, Lcom/lingren/game/MonoJavaHelper;->s_Application:Landroid/app/Application;

invoke-virtual {v2}, Landroid/app/Application;->getPackageName()Ljava/lang/String;

move-result-object v2

invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v0

const-string v2, "/files/Res/AssistObj/"

invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v0

invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v0

.line 84
const-string v2, "MonoJavaHelper"

new-instance v3, Ljava/lang/StringBuilder;

invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

const-string v4, "ExternalStorageState Not UseAble:"

invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v3

invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v1

invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v1

invoke-static {v2, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

goto :goto_0

.line 95
:cond_1
:try_start_1
invoke-virtual {p0}, Landroid/app/Activity;->getApplicationContext()Landroid/content/Context;

move-result-object v1

invoke-virtual {v1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;

move-result-object v1

invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

move-result-object v0

.line 96
new-instance v1, Ljava/lang/StringBuilder;

invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v1

const-string v2, "/Res/AssistObj/"

invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v1

invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
:try_end_1
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

move-result-object v0

goto :goto_1

最佳答案

您的示例似乎不完整。例如,它具有 goto :goto_0 但不包含 :goto_0 标签。无论如何,以下示例应该可以帮助您弄清楚如何处理您的情况。 Smali代码如下:

if-nez v0, :cond_0

const-string v2, "hello 1"

:goto_0
return-void

:cond_0
const-string v2, "hello 2"
goto :goto_0

对应于 Java 代码,例如:

if (i == 0) {
s = "hello 1";
}
else {
s = "hello 2";
}
return;

goto 语句和分支的确切位置取决于编译器。另外,对于不同的条件,您可能会看到 if-nezif-eqz 或其他一些语句。

关于reverse - 将 else 语句复制到 if 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40613470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com