mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
521 B
27 lines
521 B
// fltsafe.h
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//
|
|
|
|
// FLOATSAFE
|
|
//
|
|
// Saves floating point state on construction and restores on destruction.
|
|
//
|
|
struct FLOATSAFE
|
|
{
|
|
KFLOATING_SAVE FloatSave;
|
|
NTSTATUS ntStatus;
|
|
|
|
FLOATSAFE::FLOATSAFE(void)
|
|
{
|
|
ntStatus = KeSaveFloatingPointState(&FloatSave);
|
|
}
|
|
|
|
FLOATSAFE::~FLOATSAFE(void)
|
|
{
|
|
if (NT_SUCCESS(ntStatus))
|
|
{
|
|
KeRestoreFloatingPointState(&FloatSave);
|
|
}
|
|
}
|
|
};
|