● 関数リファレンス
レジスタスタックが全て空になっているか調べる
int __stdcall floatex_isempty(void);
引数
無し
戻り値
レジスタスタックが全て空の場合は 1 、それ以外は 0 を返します。
スタックフォルトが発生している場合は -1 を返します。
説明
レジスタスタックが空であるかを調べます。タグワードが 0xffff の時は 1 、それ以外は 0 を返しますが、スタックフォルトが発生している場合は、状態に関わらず -1 を返します。
例外の処理やフラグのクリアは行われません。必要がある場合は他の関数や処理の組み合わせで行ってください。
この関数は、eax 以外の汎用レジスタの内容を変えません。また、EFLAGS の内容を保存します。
テスト.
#include <stdio.h>
#include "floatex.h"
void __cdecl main(void)
{
FLOATEX v;
int i;
floatex_reset();
i = 8;
do{
_asm fld1
}while(--i);
printf("%d\n",floatex_isempty());
i = 0;
do{
_asm fstp tbyte ptr v
printf("pop : %d ",i + 1);
printf("%d\n",floatex_isempty());
}while(++i < 9);
floatex_reset();
}
結果.
0
pop : 1 0
pop : 2 0
pop : 3 0
pop : 4 0
pop : 5 0
pop : 6 0
pop : 7 0
pop : 8 1
pop : 9 -1